#include<stdio.h>
int main()
{
    int n;
    scanf("%d", &n);
    int i;
    int a = 0;
    int c = 1000;
    while(n)
    {
        a += (n % 10 ) * c;
        n /= 10;
        c /= 10;
    }
    printf("%04d", a);
}