#include<bits/stdc++.h>
using namespace std;
int a,b,c,d,x,z,s;
int main(){   
    cin>>x;
    a=x%10;
    b=x/10%10;
    c=x/100%10;
    s=x/1000%10;
    z=a*10+b*1+c*1000+s*100;
    cout<<z;
}

/**************************************************************
	Problem: 1619
	User: chenyichuen
	Language: C++
	Result: Accepted
	Time:17 ms
	Memory:2072 kb
****************************************************************/