n = int(input()) a,b = n//1000, n//100%10 c,d = n%100//10 ,n%10 res = b*1000 + a*100 + d*10 + c print(res)