#include <iostream>
using namespace std;
int main() {
int num;
cin >> num;
// 分解各位数字
int thousand = num / 1000; // 千位
int hundred = (num / 100) % 10; // 百位
int ten = (num / 10) % 10; // 十位
int unit = num % 10; // 个位
// 每位加5然后对10取余
thousand = (thousand + 5) % 10;
hundred = (hundred + 5) % 10;
ten = (ten + 5) % 10;
unit = (unit + 5) % 10;
// 颠倒数字
int encrypted = unit * 1000 + ten * 100 + hundred * 10 + thousand;
cout << encrypted << endl;
return 0;
}
/**************************************************************
Problem: 1109
User: huangcanwu
Language: C++
Result: Accepted
Time:8 ms
Memory:2072 kb
****************************************************************/