v#include <bits/stdc++.h>
using namespace std;
int main(){
int x,g,s,h,b,n=0;
cin>>x;
g=x%10;
s=x/10%10;
h=x/100%10;
b=x/1000;
g=(g+5)%10*1000;
s=(s+5)%10*100;
h=(h+5)%10*10;
b=(b+5)%10;
n=g+s+h+b;
cout<<n;
}
/**************************************************************
Problem: 1109
User: chenmingyu
Language: C++
Result: Compile Error
****************************************************************/