#include <stdio.h>
#include <stdint.h>
uint32_t update_register(uint32_t reg) {
uint32_t copy=reg;
reg=(reg>>10)&31;
if(reg<31)
{
reg++;
}
copy&=~(31<<10);
copy|=reg<<10;
return copy;
}
int main() {
uint32_t reg;
scanf("%u", ®);
uint32_t updated = update_register(reg);
printf("%u", updated);
return 0;
}