#include <iostream>
#include <algorithm>
using namespace std;
int main()
{
long long int n{ 0 }, z{ 0 };
while (cin >> n) {
size_t ans[120];
for (; n != 0; n = n / 10) {
int tmp = n % 10;
if (n / 10 != 0 || (n / 10 == 0 && n != 9)) {
tmp = min(tmp, 9 - tmp);
}
ans[z++] = tmp;
}
for (int i = z - 1; i >= 0; i--) {
cout << ans[i];
}
cout << endl;
}
return 0;
}
var
s: string;
i,n: integer;
begin
readln(s);
n:=1;
for i:=1 to length(s) do
if ((s[i]='3') or (s[i]='6') or (s[i]='9')) then
n:=n*(ord(s[i])-48);
write(n);
end.
program noname;
uses crt;
var
x,y:real;
begin
clrscr;
write('x='); readln(x);
write('y='); readln(y);
if (x>1) or (x<-1)or (y>1) or (y<-1) then
writeln('no')
else writeln('yes');
readkey;
end.