#include<bits/stdc++.h>
using namespace std;
int main(){
	int x,s,g,sh,b,q;
	cin>>x;
	g=x%10*1000;
	sh=x/10%10*100;
	b=x/100%10*10;
	q=x/1000;
	s=g+sh+b+q;
	cout<<s;

	
}

/**************************************************************
	Problem: 1029
	User: yangjunwen
	Language: C++
	Result: Accepted
	Time:8 ms
	Memory:2072 kb
****************************************************************/