import java.util.Scanner;
public class Main {
    public static void main(String[] args) {
        Scanner scan = new Scanner(System.in);
        int n = scan.nextInt();
        int a = 0;
        int b = 0;
        int c = 0;
        int d = 0;
        for(int i = 1; i <= 4; i++) {
            a = n / 1000;
            b = n / 100 % 10;
            c = n / 10 % 10;
            d = n % 10;
        }
        System.out.printf("%d%d%d%d", d, c, b, a);
    }
}