#include<stdio.h>
int main() {
int n;
while (scanf("%d", &n) != EOF) {
if (n >= 1000 && n <= 9999)
for (int i = 0; i < 4; i++) {
printf("%d", n % 10);
n /= 10;
}
}
return 0;
}
int main() {
int n;
while (scanf("%d", &n) != EOF) {
if (n >= 1000 && n <= 9999)
for (int i = 0; i < 4; i++) {
printf("%d", n % 10);
n /= 10;
}
}
return 0;
}