#include<bits/stdc++.h>
using namespace std;
int main(){
    int x,a,b,c,d;
    cin>>x;
    a=x%10*10;
    b=x/10%10*1;
    c=x/100%10*1000;
    d=x/1000%10*100;
    cout<<a+b+c+d;
}
/**************************************************************
	Problem: 1619
	User: linyuhang
	Language: C++
	Result: Accepted
	Time:9 ms
	Memory:2072 kb
****************************************************************/