#include <stdio.h>

int main()
{
    int n;
    scanf(" %d", &n);
    int one;
    int ten;
    int hundred;
    int thousand;
    one = n % 10;
    ten = (n / 10) % 10;
    hundred = (n / 100) % 10;
    thousand = (n / 1000) % 10;
    printf("%d%d%d%d", one, ten, hundred, thousand);
    return 0;
}