"""
P1100 高低位交换(python3实现)
https://www.luogu.com.cn/problem/P1100
"""
x=int( input() )
ans=( ( x & 0x0000ffff )<< 16 | ( x & 0xffff0000 ) >> 16 )
print( ans )
"""
P1100 高低位交换(python3实现)
https://www.luogu.com.cn/problem/P1100
"""
x=int( input() )
ans=( ( x & 0x0000ffff )<< 16 | ( x & 0xffff0000 ) >> 16 )
print( ans )