#include<bits/stdc++.h>
using namespace std;
int main(){
int x,i=0,a=0,s=0,o=0,z=0;
cin>>x;
i=x%10;
a=x%100/10;
s=x%1000/100;
o=x/1000;
z=i*1000+a*100+s*10+o;
cout<<z;
}
/**************************************************************
Problem: 1029
User: huxuanchen
Language: C
Result: Compile Error
****************************************************************/