#include <stdio.h>
using namespace std;
int main() {
    int n;
    scanf("%d", &n);
    int unit = n % 10;
    int ten = (n / 10) % 10;
    int hundred = n / 100;
    
    int first_three = unit * 100 + ten * 10 + hundred;
    int result = first_three * 1000 + n;
    
    printf("%d", result);
    return 0;
}
/**************************************************************
	Problem: 1620
	User: fuhoubin
	Language: C++
	Result: Accepted
	Time:7 ms
	Memory:1144 kb
****************************************************************/