#include<iostream>
#include<cmath>
using namespace std;
using ll=long long;
int main() {
ll n,temp=0,number=0;
ll container;
cin>>n;
while(n){
container=n%10;
if(container<9-container||9-container==0){
number+=pow(10,temp)*container;
}
else{
number+=pow(10,temp)*(9-container);
}
n/=10;
temp++;
}
cout<<number;
return 0;
return 0;
}Preformatted text