#include <iostream>
using namespace std;
int main() {
int num;
cin >> num; // 读取输入的四位数
// 分解每一位数字并进行加密处理
int a = (num / 1000 + 5) % 10; // 千位数
int b = (num / 100 % 10 + 5) % 10; // 百位数
int c = (num / 10 % 10 + 5) % 10; // 十位数
int d = (num % 10 + 5) % 10; // 个位数
// 颠倒顺序并组合成新数字
int encrypted = d * 1000 + c * 100 + b * 10 + a;
cout << encrypted << endl;
return 0;
}
/**************************************************************
Problem: 1109
User: linmiaoling
Language: C++
Result: Accepted
Time:7 ms
Memory:2072 kb
****************************************************************/