#include <iostream>

int main() {
    int x;
    std::cin >> x;

    int a = x % 10;
    int b = (x / 10) % 10;
    int c = (x / 100) % 10;
    int d = x / 1000;

    int reversed_num = a * 1000 + b * 100 + c * 10 + d;
    std::cout << reversed_num << std::endl;

    return 0;
}    
/**************************************************************
	Problem: 1029
	User: fuyijun
	Language: C++
	Result: Accepted
	Time:7 ms
	Memory:2072 kb
****************************************************************/