#include<stdio.h>
int main(){
int x;
scanf("%d",&x);
int q = x / 1000;
int b = x / 100 % 10;
int s = x / 10 % 10;
int g = x % 10;
int c = g * 1000 + s * 100 + b * 10 + q;
printf("%d",c);
return 0;
}
/**************************************************************
Problem: 1029
User: admin
Language: C
Result: Accepted
Time:9 ms
Memory:1144 kb
****************************************************************/