#include<bits/stdc++.h>
using namespace std;
int main(){
int x,s,g,sh,b,q;
cin>>x;
g=(x%10+5)%10*1000;
sh=(x/10%10+5)%10*100;
b=(x/100%10+5)%10*10;
q=(x/1000%10+5)%10;
s=g+sh+b+q;
cout<<s;
}
/**************************************************************
Problem: 1109
User: yangjunwenredianling
Language: C++
Result: Accepted
Time:7 ms
Memory:2072 kb
****************************************************************/