s=int(input()) a=s//10%10 b=s//1000%10 c=s//100%10 d=s%10 if c==0: print(str(b)+str(d)+str(a)) else: print(str(c)+str(b)+str(d)+str(a))