import java.util.Scanner;
// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
// 注意 hasNext 和 hasNextLine 的区别
int n = in.nextInt();
//获取倒立数
int high = n / 100;
int highhigh = high / 10;
int highlow = high % 10;
int low = n % 100;
int lowhigh = low / 10;
int lowlow = low % 10;
int daoli = lowlow * 1000 + lowhigh * 100 + highlow * 10 + highhigh;
int temp = daoli;
//使用变量表示相对应的位数
int i = 0;
while (temp > 0) {
temp = temp / 10;
i++;
}
for (int j = 4 - i; j > 0; j--) {
System.out.print(0);
}
System.out.print(daoli);
}
}