#include <bits/stdc++.h> 
#include <chrono>
using namespace std;
 
template<class T> inline string toString(T x) {ostringstream sout;sout<<x;return sout.str();}
 
 
//typedef
//------------------------------------------
typedef pair<int, int> PII;
typedef long long LL;
typedef pair<LL, LL> PLL;
 
//container util
//------------------------------------------
#define PB emplace_back
#define MP make_pair 
#define SZ(a) int((a).size())
//repetition
//------------------------------------------
#define FOR(i,a,b) for(LL i=(a);i<(b);++i)
#define REP(i,n)  FOR(i,0,n)
#define SORT(c) sort((c).begin(),(c).end())
#define ALL(a)  (a).begin(),(a).end()
#define CLR(a) memset((a), 0 ,sizeof(a))
//constant
//--------------------------------------------
//clear memory

int main(){
    int X;
    cin>>X;
    cout<<100-X%100<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;

#define fo(i,n) for(int i=0;i<n;i++)
#define Fo(i,k,n) for(int i=k;k<n?i<n:i>n;k<n?i+=1:i-=1)
#define ll long long
#define ull unsigned long long
#define pb push_back
#define mp make_pair
#define F first
#define S second
#define all(x) x.begin(), x.end()
#define clr(x) memset(x, 0, sizeof(x))
#define sortall(x) sort(all(x))
#define count_setbits __builtin_popcountll
#define fast ios_base::sync_with_stdio(false);cin.tie(NULL);cout.tie(NULL);
#define PI 3.1415926535897932384626
mt19937_64 rang(chrono::high_resolution_clock::now().time_since_epoch().count());

typedef vector<int>     vi;
typedef vector<ll>      vl;


const ll mod = 1'000'000'007;
//const ll mod= 998244353;

const int N = 5e5 + 20;
vi adj[N];
int sieve[N+1];
bool vis[N];
ll fac[N];
map<ll,ll> factor;
int dx[4] = {0, 1, 0, -1};
int dy[4]={1, 0, -1, 0};

const int maxn = 1e6+10;
const ll INF = 1e18; 

void solve(){
   string s;
   cin >> s;
   reverse(s.begin(), s.end());
   for(int i=0; i<(s.size()); i++){
    if(s[i]=='6') s[i]='9';
    else if(s[i]=='9') s[i]='6';
   }

   cout<<s<<endl;
}



int main() {

    #ifndef ONLINE_JUDGE
    // for getting input from input.txt
    freopen("input.txt", "r", stdin);
    // for writing output to output.txt
    freopen("output.txt", "w", stdout);
    #endif
    
    fast;
    /*clr(sieve);
    sieve[1]=1;
    for(int x=2;x<=1010;x++)
    {
        if(sieve[x]) continue;
        for(int u=2*x;u<=1010;u+=x)
        {
            sieve[u]=x;
        }
    }*/
    /*
    fac[0]=1;
    fac[1]=1;
    Fo(i,2,3e5)
    {
        fac[i]=((fac[i-1]%mod)*i)%mod;
    }
    */

    int t;
    //cin>>t;
    t=1;
    while(t--)
    {
      solve();
    }
    return 0;
}