#include<bits/stdc++.h> using namespace std; int main(){ int a,b; cin>>b; a=b%10*1000+b/10%10*100+b/100%10*10+b/1000; cout<<a<<endl; return 0; }