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