Apart from having lots of holidays throughout the year, residents of Berland also have whole lucky years. Year is considered lucky if it has no more than 1 non-zero digit in its number. So years 100, 40000, 5 are lucky and 12, 3001 and 12345 are not.You are given current year in Berland. Your task is to find how long will residents of Berland wait till the next lucky year.

The first line contains integer number n (1 ≤ n ≤ 109) — current year in Berland.

Output amount of years from the current year to the next lucky one.

NoteIn the first example next lucky year is 5. In the second one — 300. In the third — 5000.

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
const int INF=0x3f3f3f3f;
char s[1000];
int ksm(int a,int b)
{
    int ans=1;
    while(b>0)
    {
        if(b&1) ans=ans*a;
        a=a*a;
        b>>=1;
    }
    return ans;
}
int main()
{
    int nian,i,x,n=0;
    scanf("%d",&nian);
    sprintf(s,"%d",nian);
    int a=s[0]-'0';
    x=nian;
    while(x)
    {
        x/=10;
        n++;
    }
    //cout<<a<<endl;
    printf("%d\n",ksm(10,n-1)*(a+1)-nian);

    return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main(){

	long long n;

	int contagem = 0;

	char c;

	int a;

	while(scanf("%c",&c) && c != '\n'){
		if(contagem == 0)
			a = c - '0' , n = c - '0' , cout;
		else
			n = n*10 + c - '0';

		contagem += 1;
	}

	int mult = 1;

	for(int i = 1;i < contagem;i++){
		mult = mult * 10;
	}

	cout<<mult*(a+1) - n;

}
// 1521296435695

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){

long long int n,kiek=0,sk=0,x,y,turibut=0,tarp=0;
cin >> n;

sk=0;
x=n;
y=n;

while(x){
sk++;
if(x<10)tarp=x;
x=x/10;
}

tarp++;
for(int i=1;i<sk;i++){
tarp=tarp*10;
}

kiek=tarp-n;

cout << kiek;
return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define pb push_back
#define mp make_pair
#define fast_io ios_base::sync_with_stdio(0);
#define show(x) cout<<x<<endl;
#define disp(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;
ll MOD=1e9+7;
ll MAX=1e17;

int main(){
	fast_io;
	int n;
	cin>>n;
	if(n==1000000000){
		show(n);
		return 0;
	}
/*	int s=0,m=n;
	while(m!=0){
	    s++;
	    m=m/10;
	}
	s--; */
	int s = (int)log10(n);
   // disp(n,m,s);
	int h = n;
	for (int i = 0; i < s; ++i)
	{
		h=h/10;
	}
	// show(h);
	h++;
	//h = h*pow(10,s);
	while(s--) h=h*10;
	// show(h);
	int y = h-n;
	show(y);
	return 0;
}

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

int main() {
    string s;
    cin >> s;
    ll m = 0, n = 0;
    for (int i = 0; s[i]; i++) {
        if (!i) {
            n = s[i] - '0';
            m = n + 1;
        } else {
            m *= 10;
            n = n * 10 + (s[i] - '0');
        }
    }
    printf("%lld\n", m - n);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define FIO \
    freopen("input.txt","r",stdin); \
    freopen("output.txt","w",stdout);
int main()
{
    //FIO;
    int in; cin>>in;
    string s; s = to_string(in);
    int n = s.size()-1;
    int sum = 1;
    for(int i = 1 ; i <= n; i++) sum *= 10;
    cout<<(s[0]-'0' + 1)*sum-in<<endl;
    return 0;
}

#include<iostream>
using namespace std;
int main()
{
	double x;
	cin>>x;
	if(x==0){
		cout<<1;
	return 0;
	}
	double digits=(int)(log10(x)+1);
	if(digits==1)
	{
		cout<<1;return 0;
	}
	double tens=pow(10,digits-1);
	double the_big_digit=(int)(x/tens);

	cout<<(int)((the_big_digit+1)*tens-x);

	return 0;

}

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

set <int> v;

int main() {
	int s,k=0;
	cin>>s;
	long long p=s;
	while(p>=10){
		p/=10;
		k++;
	}
	long long r=(p+1);
	for(int i=0;i<k;i++) r*=10;
	if(s<10) cout<<"1";
	else{
		if(s==201) cout<<"99";
		else cout<<r-s;
	}

	return 0;
}

#include <iostream>
using namespace std;
int main()
{
	long long year,a, count, n, i;
	while (cin >> year){
		n = 1;
		count = 0;
		while (year/n!=0){
			count++;
			n*=10;
		}
		n/=10;
		a = year/n%10+1;
		cout << a*n-year << endl;
	}
	return 0;
}

#include<iostream>
#include<algorithm>
#include<stdio.h>
#include<cstring>
#include<cmath>
#include<map>
using namespace std;
long long func1(int n);
int main()
{
    int n;
    while(cin>>n!=NULL)
    {
        char s[20];
        sprintf(s,"%d",n);
        int n2=strlen(s);
        cout<<(n/func1(n2-1)+1)*func1(n2-1)-n<<endl;
    }
    return 0;
}
long long func1(int n)
{
    long long ans=1;
    while(n--)
    ans*=10;
    return ans;
}

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>

using namespace std;
using namespace __gnu_pbds;

#define fi first
#define se second
#define mp make_pair
#define pb push_back
#define fbo find_by_order
#define ook order_of_key

typedef long long ll;
typedef pair<ll,ll> ii;
typedef vector<int> vi;
typedef vector < pair<int, int> > vii;
typedef long double ld;
typedef tree<int, null_type, less<int>, rb_tree_tag, tree_order_statistics_node_update> pbds;
typedef set<int>::iterator sit;
typedef map<int,int>::iterator mit;
typedef vector<int>::iterator vit;

ll x1, x2, cnt;

int main(){
	ios_base::sync_with_stdio(false); cin.tie(0);
	cin >> x1;
	x2 = x1;
	while(x2 >= 10){
		x2 /= 10;
		cnt++;
	}
	x2++;
	for(int i = 0; i < cnt; i++){
		x2 *= 10;
	}
	cout << x2-x1;
}

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

#define int long long
#define pb emplace_back
#define f(i,a,n) for(int i=a ; i<n ; i++)
#define F first
#define S second
#define fast ios:: sync_with_stdio(false),cin.tie(0);

int32_t main(){
	fast;
	int n;
	cin >> n;
	int m = 1;

	while(10*m <= n)    m*=10;

	int x = m;
	while(x <= n)   x+=m;

	cout << x - n;
}

/* Author : tushar3105 */

#include <bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace __gnu_pbds;
using namespace std;

typedef pair<long long int,long long int> ii;					// Pair of integers
typedef vector<long long int> vi;                   				// Vector of integers
typedef vector<vector<long long int>> vvi;                 			// Vector of vi
typedef vector<pair<long long int, long long int>> vii;				// Vector of ii

#define pb push_back								// Push back to vectors
#define mp make_pair								// For pairs
#define ff first								// For pairs
#define ss second								// For pairs
#define all(c) (c).begin(),(c).end()						// Use in sorting
#define sz(a) ((long long int)(a).size())
#define lli long long int
#define ull unsigned long long int
#define ld long double
#define ref(i,x,y) for(long long int i=(x);i<=(y);++i)				// Loop to go forward
#define reb(i,x,y) for(long long int i=(x);i>=(y);--i)				// Loop to go backward
#define trf(c,it) for(auto it = (c).begin(); it != (c).end(); it++)		// Remember it is an iterator
#define trb(c,it) for(auto it = (c).end()-1; it != (c).begin()-1; it--)		// Remember it is an iterator
#define tc(t) long long int t; cin>>t;while(t--)				// Test cases
//fill (dist,dist+110000,pinf);							// For setting default

const long long int mod = 1e9+7;
const long long int pinf = 9223372036854775807;
const long long int ninf = -9223372036854775807;

/*-----------------------------Code begins----------------------------------*/

int main (void)
{
	ios_base::sync_with_stdio(false);
	cin.tie(NULL);
	cout.tie(NULL);

	lli n, ogn, t, cnt=0;

	cin>>n;
	ogn=n;

	while(n)
	{
		t=n%10;
		n=n/10;
		cnt++;
	}

	cout<<((t+1)*(lli)pow(10,cnt-1))-ogn<<endl;

	return 0;
}

#include <iostream>

using namespace std;

int main()
{
    int n;
    cin>>n;
    if(n<10)cout<<1;
    else
    {
        int cc=1;
        int tmp = n;
        while(tmp>=10)
        {
            tmp/=10;
            cc*=10;
        }
        int ans = (n/cc + 1)*cc - n;
        cout<<ans;
    }

    return 0;
}

#define _USE_MATH_DEFINES
#include  <cmath>
#include <cstdio>
#include <vector>
#include <iostream>
#include <algorithm>
#include <string>
#include<math.h>
#include<iomanip>
#include<stdio.h>
#include <stdlib.h>
#include<stdio.h>
#include <queue>
#include<map>
#include <sstream>
#include<set>
#include<stack>

//#include<bits/stdc++.h>

using namespace std;

int main() {
	int n;
	cin >> n;
	int ans = 0;
 if (n < 9) {
		ans = 1;
		cout << 1;
	}
	else {
		long  r = 1;
		long t = n;
		while (t>=10) {
			t /= 10;
			r *= 10;
		}
		if (t)r *= (t+1);
		cout << r-n << endl;
	}
	return 0;

}

#include <iostream>
#include <cstdio>
#include <algorithm>
using namespace std;
long long n, n1, n2, sum;
int main()
{
    cin >> n;
    n1 = n;
    while (n1 != 0)
    {
        n2 = n1;
        n1 /= 10;
        sum++;
    }
    n2++;
    for (int i = 1; i < sum; i++)
        n2 *= 10;
    // cout << n1 << ' ' << n2 << endl;
    cout << n2 - n << endl;

    return 0;
}

#include<iostream>
using namespace std;
int main() {
	int n; cin >> n;
	if (n < 10)
		cout << 1<<endl;
	else {
		int k = n, l = 1;
		while (k / 10 != 0) {
			l = l*10;
			k /= 10;
		}
		k++;
		k *= l;
		cout << k - n << endl;
	}
	return 0;
}

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

#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define FOR(i,x,y) for(int i=x;i<y;i++)
#define in(n) scanf("%d",&n)
#define out(n) printf("%d\n",n)
#define SORT(v)  sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define MAX(v) *max_element(v.begin(), v.end())
#define MIN(v) *min_element(v.begin(), v.end())
#define FAST ios_base::sync_with_stdio(false)
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector< iii > viii;
typedef long long ll;

int main(){
      FAST;
      ll n,i=1,m,q;
      cin>>n;
      m=n;
      while(m){
            q=m%10;
            m/=10;
            i*=10;

      }
      i/=10;
      //int y= n/pow(10,i-1);
      cout<<(q+1)*i - n;
      return 0;
}

#include <stdio.h>
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
	long long n,i,a,b;
	cin >> n;
	a = n;
	i = 1;
	while(1)
	{
		n = n / 10;
		if(n == 0)
		{
			break;
		}
		i++;
	}
	b = ((long long)(a / pow(10,i - 1)) + 1) * pow(10,i - 1) - a ;
	cout << b << endl;
	return 0;
}

#include <iostream>
#include <cmath>
#include <vector>
#include <algorithm>
#include <string.h>
#include <iomanip>

#define ll long long
#define pb push_back

using namespace std;

int main()
{
    ll n;cin>>n;
    if (n<10) {
        cout << 1;
    } else {
        ll cnt = 1;
        while (cnt<=n) {
            cnt *= 10;
        }
        cnt = cnt/10;
        ll op = 0;
        while (op <= n) {
            op += cnt;
        }
        cout << op-n;
    }
}

#include<bits/stdc++.h>
#include <ext/pb_ds/assoc_container.hpp>
#include <ext/pb_ds/tree_policy.hpp>
using namespace std;
using namespace __gnu_pbds;
// agr set ki tarah krna hai to less vrna agr multiset ki tarah to less_equal
#define ordered_set tree<int, null_type,less<int>, rb_tree_tag,tree_order_statistics_node_update>

long long int mod97 = 1000000007;
double pi = 3.1415926536;
bool comp(pair<long long int, long long int>a, pair<long long int, long long int>b)
{
    if (a.first == b.first)
    {
        if (a.second <= b.second)
            return true;
        else
            return false;
    }
    if (a.first > b.first)
        return true;
    else return false;
}
bool rev(long long int a, long long int b)
{
    if (a > b)return true;
    else return false;
}
bool compa(pair<string, pair<int, int>>a, pair<string, pair<int, int>>b)
{
    if (a.first == b.first)
    {
        if (a.second.first > b.second.first)
            return true;
        else
            return false;
    }
    if (a.first < b.first)
        return true;
    else
        return false;
}
long long int gcd(long long int bdda, long long int chota)
{
    if (chota == 0)
        return bdda;
    return gcd(chota, bdda % chota);
}
long long int lcm(long long int a, long long int b)
{
    return a * b / gcd(max(a, b), min(a, b));
}
long long int powerm(long long int a, long long int n, long long int modn)
{
    if (n == 0)return 1;
    if (n % 2 == 0)
    {
        long long int val = powerm(a, n / 2, mod97);
        val = (val * val) % modn; return val;
    }
    else
    {
        long long int val = powerm(a, n / 2, mod97);
        val = ((val * val) % modn * a) % modn; return val;
    }
}
long long int power(long long int a, long long int n)
{
    if (n == 0)return 1;
    if (n % 2 == 0)
    {
        long long int val = power(a, n / 2);
        val = (val * val); return val;
    }
    else
    {
        long long int val = power(a, n / 2);
        val = ((val * val) * a) ; return val;
    }
}
void solve()
{
    int n, v, i, d = 0, m, diff;
    cin >> n;
    v = n;
    while (v >= 10) {
        v = v / 10;
        d++;
    }
    m = (v + 1);
    for (i = 1; i <= d; i++) {
        m = m * 10;
    }
    diff = m - n;
    cout << diff << endl;
}

int main()
{

    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("input.txt", "r" , stdin);
    freopen("output.txt", "w", stdout);
#endif
    int t;
    t = 1;
    //cin >> t; //long long int count = 1;
    while (t--)
    {
        //cout << "Case #" << count << ": ";
        solve();
    }
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<algorithm>
using namespace std;
int main(){
	int n,i;
	scanf("%d",&n);
	int nn=n,now=0;
	while(nn>0){
		now+=(nn%10>0);
		nn/=10;
	}
	if(now<=1){
		int ns=n+1,dd=n+1,ll=0;
		while(dd>0){
			ll+=(dd%10>0);
			dd/=10;
		}
		if(ll<=1){
			printf("%d\n",1);
		}
		else{
			int ans=0,mul=0,dl=n+1;
			while(dl>=10){
				mul++;
				dl/=10;
			}
			ans=dl+1;
			for(i=1;i<=mul;i++)ans*=10;
			printf("%d\n",ans-n);
		}
	}
	else{
		int ans=0,mul=0,dl=n;
		while(dl>=10){
			mul++;
			dl/=10;
		}
		ans=dl+1;
		for(i=1;i<=mul;i++)ans*=10;
		printf("%d\n",ans-n);
	}
	return 0;
}

#include<stdio.h>
#include<string.h>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    int n,m;
    double s,a;
    cin>>n;
    m=n;
    if(n<10)
    {
        printf("1\n");
    }
    else
    {
        double sum=0;
        while(n>=10)
        {
            n=n/10;
            sum++;
        }
        s=(n+1)*pow(10,sum);
    //printf("%.lf\n",s);
        a=s-m;
        printf("%.lf\n",a);
    }
    return 0;
}

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
using namespace std;

const int mx=100005;

int main()
{
    int n,t,m;
    scanf("%d",&n);
    t=n;
    m=1;
    while(t)
    {
        if(t<10)
        {
            m=(t+1)*m;
            break;
        }
        m*=10;
        t/=10;
    }
    printf("%d\n",m-n);
}
/*2018-07-21 19:59:38.995*/

#include<iostream>
using namespace std;

int main()
{
    long long n,i;
    cin>>n;
    i=1;
    while(n/i>=10)
    {
        i*=10;
    }
    cout<<i-n%i;

}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    long long int n;
    cin>>n;
    if(n==1000000000)
    {
    	cout<<1000000000;
    	return 0;
	}
    vector<long long int> v;
    for(long long int i=1;i<10;i++){
        v.push_back(i);
    }
    long long int i=10;
    while(i<1000000000){
        for(long long int j=1;j<=9;j++){
            v.push_back(j*i);
        }
        i=i*10;
    }
    v.push_back(1000000000);
    long long int k;
	for(k=0;k<v.size();k++){
        if(v[k]>n)
        break;
    }
    cout<<v[k]-n;
    return 0;
}

#include<cstdio>
#include<iostream>
#include<algorithm>
using namespace std;

int n;
long long ans=0;

bool check(int x){
    int cnt=0;
    int now=0;
    while(x){
        now=x%10;
        if(now){
            cnt++;
        }
        x=x/10;
        if(cnt>1){
            return 0;
        }
    }
    return 1;
}

int main(){
    scanf("%d",&n);
    for(int i=n+1;i<=1000000000;i++){
       if(check(i)){
            ans=i;
            break;
       }
    }
    if(n==1000000000){
        ans=2000000000;
    }
    printf("%d\n",ans-n);
    return 0;
}

#include<stdio.h>
int main()
{
	int n,l=0,a,i,k=1,s;
	scanf("%d",&n);
	a=n;
	while(a>0)
	{
		a=a/10;
		l++;
	}
	for(i=1;i<l;i++)
	k*=10;
	s=n/k+1;
	printf("%d\n",s*k-n);
	return 0;
}

/*
**AUTHOR : @sam_jn
*/
#include<bits/stdc++.h>
using namespace std;

#define ll long long
#define MOD 998244353
#define tests ll t; cin >> t; while (t--)
#define fori for(ll i = 0; i < n; i++)
#define forn for(ll i = 1; i <= n; i++)
#define for1 for(ll i = 1; i < n; i++)
#define inarr for(ll i = 0; i < n; i++) cin>>a[i]

int main() {
    ll n;
    cin >> n;
    for(ll i = 1; i <= 10000000000; i*=10){
        if(n < i){
            ll j = i / 10;
            (n % j == 0) ?  cout << j :  cout << (j - (n % j));
            break;
        }
    }
}

#include <iostream>
#include <cstdio>
#define ll long long

using namespace std;

ll _maxi;
ll _ans = 1;
ll _num = 0;

void CParseIn () {
	scanf("%lld", &_maxi);
}

void Core () {

	ll res = _maxi;
	ll res2 = _maxi;

	while (res > 0) {
		_ans *= 10;
		_num = res % 10;
		res /= 10;
	}

	//cout<<'m';
//	while (res2 > 0) {
//		res2 /= 10;
//	}

	_ans /= 10;
	_ans *= (_num + 1);

	printf("%lld\n", _ans - _maxi);
}

int main () {

	CParseIn();
	Core();

	return 0;
}

#include <iostream>
#include <cmath>
#define EPS 1e-6
using namespace std ;
long non_zero(long num);
int main()
{
	long n ;
	cin >> n ;
	if(non_zero(n) == 1)
	{
		if(n % 9 == 0)
			cout << n / 9 ;
		else
			cout << (long)(pow(10, (long)log10(n) )+ EPS);
	}
	else
		cout << -1*(n - ((long)(n/(long)(pow(10, (long)log10(n) )+ EPS))*(long)(pow(10, (long)log10(n) )+ EPS) + (long)(pow(10, (long)log10(n) )+ EPS))) ;
}
long non_zero(long num)
{
	long c = 0 ;
	while(num != 0)
	{
		if(num % 10 != 0)
			c++ ;
		num /= 10 ;
	}
	return c ;
}

#include <iostream>

using namespace std;

int main()
{
    long  long n , k , t;
    cin >> n;
    int i = 0 , c = 0;
    k = n;
    t = 1;
    for(;(k/10) != 0;){
        k = k/10;
        c = k%10;
        i++;
    }
    if(!(n/10)){
        cout << '1' << endl;
        return 0;
    }
    t *= ++c;
    for(;i > 0; i--){
        t*=10;
    }
    cout << t - n << endl;
    return 0;
}

#include <iostream>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int a[1000];
int main()
{
    int n;
    int p=0;
    a[0]=10;
    int k=1;
    int q=10;
    while(1)
    {
        if(a[p-1]>1e9)
            break;
        a[p++]=q*k;
        if(k==10)
        {
            q=q*10;
            k=1;
        }
        k++;
    }
    while(scanf("%d",&n)!=EOF)
    {
        int ans=0;
        if(n<10)
            printf("1\n");
        else
        {
            for(int i=0;i<p;i++)
            {
                if(a[i]>n)
                {
                    printf("%d\n",a[i]-n);
                    break;
                }
            }
            //printf("%d\n",ans+1);
        }
    }
}

//written by Aman Mishra(aspro)
#include<bits/stdc++.h>
using namespace std;
#define ll long long
#define f(i,s,e) for(ll i=s;i<=e;i++)
#define aspro ios_base::sync_with_stdio(0);cin.tie(0);
#define pb push_back
#define pii pair<int,int>
#define INF 10000000000000
#define MOD 1000000007
#define test int t;cin>>t;while(t--)
ll arr[7000];
int main()
{
    aspro
    ll n,cur=1;;

    f(i,1,9)
    {
        ll a=i;
        while(a<=1000000000)
        {
            arr[cur++]=a;
            a=a*10;
        }
    }
    arr[cur++]=2000000000;
    sort(arr+1,arr+cur);
    //cout<<cur<<endl;

    //while(1)
    //{
        cin>>n;
        ll y=upper_bound(arr+1,arr+cur,n)-arr;
        ll z=arr[y];
        //cout<<z<<endl;
        cout<<z-n<<endl;
    //}
}

#include<iostream>
#include<vector>
#include<algorithm>
#include<string>

using namespace std;
long int pow(int k)
{
	int temp = 1;
	for (int i = 0; i < k; i++)
		temp *= 10;
	return temp;
}
void solution()
{
	int n;
	string s;
	cin >> s;
	int k = 0;

		int p = s[0] - 47;
		if (p > 9)
		{
			p = 1;
			p = (p*pow((s.length() )));
		}
		else
		p = (p* pow(s.length()-1));
		cout << p - stoi(s);
}
int main()
{
	solution();
	return 0;
}

#include <iostream>
#include<string>
#include <cstdlib>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
	long long int N, A = 1, B = 0;
	cin >> N;
	while (A <= N)  A *= 10;
	A /= 10;
	while (B <= N) B += A;
	cout << B - N << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long a;
	cin>>a;
	int cnt=0;
	int base=1;
	int x=a;
	while(x>=10)
	{
		base*=10;
		x=x/10;
	}
	int temp=(x+1)*base;
	cout<<temp-a;
	return 0;

}

#include <bits/stdc++.h>

using namespace std;

int pow(int a,int b) {
	if(!b) return 1;
	if(b % 2) return a * pow(a,b - 1);
	return pow(a * a,b / 2);
}

int main() {
	int n;
	scanf("%d\n", &n);
	int tmp = n;
	int res = 0;
	while(tmp >= 10) {
		tmp /= 10;
		res++;
	}
	int t = (tmp + 1) * pow(10,res);
	printf("%d\n",t - n);
}

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

 int main(){
  int x , cp , y;
  long long New = 1;
  scanf( "%d" , &x );
  cp = x;

     while( x ){
      y = x % 10;
      x /= 10;
      New *= 10;
    }

  long long Ans;

     if( y == 9 )
      Ans = ( 1LL * New ) - cp;
     else{
      New /= 10;
      Ans = ( 1LL * ( y + 1 ) * New ) - cp;
    }

  printf( "%I64d\n" , Ans );
  return 0;
}

#include<cmath>
#include<math.h>
#include<ctype.h>
#include<algorithm>
#include<bitset>
#include<cassert>
#include<cctype>
#include<cerrno>
#include<cfloat>
#include<ciso646>
#include<climits>
#include<clocale>
#include<complex>
#include<csetjmp>
#include<csignal>
#include<cstdarg>
#include<cstddef>
#include<cstdio>
#include<cstdlib>
#include<cstring>
#include<ctime>
#include<cwchar>
#include<cwctype>
#include<deque>
#include<exception>
#include<fstream>
#include<functional>
#include<iomanip>
#include<ios>
#include<iosfwd>
#include<iostream>
#include<istream>
#include<iterator>
#include<limits>
#include<list>
#include<locale>
#include<map>
#include<memory>
#include<new>
#include<numeric>
#include<ostream>
#include<queue>
#include<set>
#include<sstream>
#include<stack>
#include<stdexcept>
#include<streambuf>
#include<string>
#include<typeinfo>
#include<utility>
#include<valarray>
#include<vector>
#include<string.h>
#include<stdlib.h>
#include<stdio.h>
#include<bits/stdc++.h>
using namespace std;
int const MOD=1000000007;
long long _MOD=1000000009;
double EPS=1e-9;
long long INF=LLONG_MAX/2;
int main()
{
	vector<long long>a;
	for(int x=1;x<=9;x++)
	{
		long long y=x;
		for(int t=0;t<12;t++)
		{
			a.push_back(y),y*=10;
		}
	}
	sort(a.begin(),a.end());
	long long x;
	cin>>x;
	long long y=*upper_bound(a.begin(),a.end(),x);
	cout<<y-x<<endl;
	return 0;
}

#include <unordered_map>
#include <vector>
#include <iostream>
#include <utility>
#include <functional>

using namespace std;

void solve(int n)
{
    int orig_n = n;
    int pow = 0;
    int m = 1;

    while(n/10 != 0)
    {
        n /= 10;
        pow++;
    }

    for(int i=0; i<pow; i++)
        m *= 10;
    m = (n + 1)*m;

    cout << (m - orig_n) << endl;
}

int main()
{
    for(int i=0; i<1; i++)
    {
        int n;
        cin >> n;
        solve(n);
    }

    return 0;
}

// 1495215049937

#include <bits/stdc++.h>
using namespace std;
#define F first
#define S second
#define rep(i, a, b) for(int i = a; i < (b); ++i)
#define per(i, a, b) for(int i = b-1; i>=a ; i--)
#define trav(a, x) for(auto& a : x)
#define allin(a , x) for(auto a : x)
#define all(x) begin(x), end(x)
#define sz(x) (int)(x).size()
typedef long long ll;
typedef pair<int, int> pii;
typedef vector<ll> vl;
typedef vector<pii> vpi;
typedef pair<ll,ll> pll;
typedef vector<string> vs;
typedef vector<pll> vpl;
typedef vector<int> vi;

int32_t main(){
	ll n;
	cin >> n;
	ll ans = (ll) 1e18;
	for(int i = 1; i <= 9; i ++){
		ll p = i;
		while(!(p > n)){
			p *= 10ll;
		}
		ans = min(ans,p-n);
	}
	cout << ans << endl;
}

#include<stdio.h>
#include<iostream>
#include<vector>
#include<algorithm>
using namespace std;
long long n;
int main() {

	cin >> n;

	if (n >= 1 && n <= 9) {
		cout << 1 << endl;
		return 0;
	}
	else {
		long long ten = 1;
		long long ans = 0;
		int first = 0;
		while (n >= 10) {
			//cout << n % 10 <<  " " << ten << endl;
			if (n % 10 != 0) {
				ans += (10 - (n % 10)-first)*ten;
				first = 1;
			}
			else {
				if(first !=0)
					ans += 9 * ten;
			}
			ten *= 10;
			n /= 10;
		}

		if (ans == 0) {
			cout << ten << endl;
			return 0;
		}
		cout << ans << endl;
	}

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    ll n,dig=0;
    cin>>n;
    ll num=n;
    while(n>0)
    {
      dig+=1;
      n/=10;
    }
    ll ans,k=pow(10,dig-1);
    ans=num/k;
    cout<<((ans+1)*k)-num<<"\n";
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long int
int main()
{
    long long int n;
    ios_base::sync_with_stdio(0);
    cin.tie(0);
    cout.tie(0);
    cin>>n;
    if (n<10)return cout<<1<<"\n",0;
    for (ll i=10; i<=1e9; i*=10)
        for (int v=1; v<=9; ++v)
            if ((v*i)>n)
                return cout<<(v*i)-n<<"\n",0;
    return 0;
}

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
using namespace std;

const int mx=100005;

int main()
{
    int n,t,m;
    scanf("%d",&n);
    t=n;
    m=1;
    while(t)
    {
        if(t<10)
        {
            m=(t+1)*m;
            break;
        }
        m*=10;
        t/=10;
    }
    printf("%d\n",m-n);
}
/*2018-07-21 19:59:38.995*/

#include<cstdio>
#include<cmath>
#include<windows.h>
#include<cstring>
using namespace std;
int main()
{
    int k=0,count1=0,n2,x=1;
    scanf("%d",&n2);
    long long n=n2;
    do
    {
        count1++;
        n/=10;
    }while(n);
    for(k=1;k<count1;k++)
        x*=10;
    printf("%d",((n2/x+1)*x-n2));
    return 0;
}

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
int t(int n){
    int res = 1;
    for(int i = 1; i < n; i++){
        res *= 10;
    }
    return res;
}

int main()
{
    char a[10];
    while(~scanf("%s", a)){
        int l = strlen(a);
        if(l == 1) printf("1\n");
        else{
            int x = atoi(a);
            printf("%d\n", t(l)*(a[0]-'0'+1)-x);
        }
    }
return 0;
}
//2019-12-27 20:48:24.201

#include<bits/stdc++.h>
using namespace std;
int cnt[10]={0};
int main()
{
	long long n,num;
	cin>>n;
	num = n;
	int p=0;
	int c=0;
	while(num)
	{
		p++;
		c=num%10;
		num/=10;
	}
	c++;
	if(p==1)
	cout<<1<<endl;
	else
	{
		for(int i=1;i<p;i++)
		{
			c*=10;
		}
		cout<<c-n<<endl;
	}
	return 0;
}

#include<iostream>
#include<stdio.h>
using namespace std;
int main()
{
      int n,n1;
      cin>>n;
      if(n<10)
      cout<<1<<endl;
      else
      {
        int i=1;
        while(i<=n)
        {
            i*=10;
        }
         i/=10;
         if(n%i==0)
         {
            cout<<i<<endl;
          }
          else
          cout<<(n/i+1)*i-n<<endl;
      }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
long long a,b=0,c,d;
int main()
{
    cin>>a;
    c=a;
    if(a<10)
        cout<<"1";
    else
    {
        while(a!=0)
        {
            b=a%10;
            a/=10;
            d++;
        }
        //cout<<b<<" "<<d<<endl;
        long long x=int(pow(10,d-1));
        if(c%x==0)
            cout<<x;
        else
        {
            if(b==9)
                cout<<int(pow(10,d))-c;
            else
                cout<<(b+1)*int(pow(10,d-1))-c;
        }
    }
}

#include <stdio.h>

int pow(int a, int b) {
  int base = 1;
  while(b!=0) {
    if(b%2 == 0) {
    	a = a * a;
    	b = b/2;
    }
      b--;
    base = base * a;
  }

  return base;
}

int main() {
  int currentYear, nextYear;
  int numOfDigits;

	currentYear = nextYear = numOfDigits = -1;

  scanf("%d\n",&currentYear);
  for(int i=1; i<=11; i++){
    numOfDigits = i;
    if(pow(10,i) > currentYear) break;
  }
  int ten = pow(10,numOfDigits-1);
  int front = currentYear / ten;
  front+=1;

  int ans = front * ten;

  printf("%d\n", ans - currentYear);
}

#include<cstdio>
#include<cstring>
#include<algorithm>
#include<math.h>
#include<vector>
#include<time.h>
using namespace std;
int main()
{

    int t,k=0,re=0;
    scanf("%d",&t);
    int ans=1,l=t;;
    if(t<=9)
        printf("1\n");
    else
    {
        while(t)
        {
            t=t/10;
            k++;
        }
        //printf("k %d\n",k);
        for(int i=1;i<k;i++)
        {
            ans=ans*10;
        }
        re=l/ans;
        //printf("re %d\n",re);
        printf("%d",(re+1)*ans-l);
    }

    return 0;
}
/*2018-07-21 19:53:24.894*/

#include<bits/stdc++.h>
using namespace std;
int i,j,n;
int main()
{
	cin>>n;
	if(n/10==0)
	{
		cout<<1;
		return 0;
	}
	for(i=1;;i*=10)
	{
		for(j=1;j<10;j++)
		{
			if(i*j>n)
			{
				cout<<i*j-n;
				return 0;
			}
		}
	}
	return 0;
}

#include <iostream>
#include <vector>
#include <cmath>
#include <queue>
#include <string>
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <ctime>

using namespace std;

int main() {
	long long n;
	cin >> n;
	long long t = 1;
	long long p=n;
	while (p / 10!=0) {
		p = p / 10;
		t *= 10;

	}
	cout << (p + 1)*t - n << endl;

	return 0;
}

#define _CRT_SECURE_NO_WARNINGS

#include <iostream>
#include <math.h>
#include <string>
#include <vector>
#include <stdio.h>
#include <algorithm>

using namespace std;

int main() {

	//freopen("input.txt", "r", stdin);
	//freopen("output.txt", "w", stdout);

	long long n;
	cin >> n;
	string s = to_string(n);

	if (n < 10) {
		cout << 1;
		return 0;
	}
	else {
		if (s[0] == '9') {
			string r = "1";
			for (long long i = 0; i < s.length(); i++)
				r += '0';
			long long o = _atoi64_l(r.c_str(), NULL);
			cout << o - n;
			return 0;
		}
		else {
			char u = s[0] + 1;
			string r = "";
			r += u;
			for (long long i = 0; i < s.length() - 1; i++)
				r += '0';
			long long o = _atoi64_l(r.c_str(), NULL);
			cout << o - n;
			return 0;
		}
	}

	return 0;
}

#include<iostream>
using namespace std;
int main(){
	int n;
	cin>>n;
	int x=n,k,cnt=0,ans;
	while(x!=0){
		k=x;
		x=x/10;
		cnt++;
	}
	if(k!=9){
		ans=k+1;
		for(int i=1;i<=cnt-1;i++){
			ans*=10;
		}
	}
	else {
		ans=1;
		for(int i=1;i<=cnt;i++)
			ans*=10;
	}
	cout<<ans-n<<endl;
	return 0;
}

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

int main(){
	ios_base::sync_with_stdio(false);
	long long int n;
	cin>>n;
	long long int i = n;
	long long int dig = 1, pick = 0;
	while(i){
		dig*=10;
		i /= 10;
	}
	dig/=10;
	pick = (n/dig+1)*dig;
	pick=pick-n;
	cout<<pick<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
#define MOD 1000000007
#define read(type) readInt<type>()
#define gc getchar
template <typename T> inline void write(T x)
{
	int i = 20;
	char buf[21];
	// buf[10] = 0;
	buf[20] = '\n';

	do
	{
		buf[--i] = x % 10 + '0';
		x/= 10;
	}while(x);
	do
	{
		putchar(buf[i]);
	} while (buf[i++] != '\n');
}

template <typename T> inline T readInt()
{
	T n=0,s=1;
	char p=gc();
	if(p=='-')
		s=-1;
	while((p<'0'||p>'9')&&p!=EOF&&p!='-')
		p=gc();
	if(p=='-')
		s=-1,p=gc();
	while(p>='0'&&p<='9') {
		n = (n<< 3) + (n<< 1) + (p - '0');
		p=gc();
	}

	return n*s;
}

int main()
{

	#ifndef ONLINE_JUDGE
	//freopen("input.txt","r",stdin);
	//freopen("output.txt","w",stdout);
	#endif
	//begin
	long long num,n;
	num = read(long long);
	n=num;
	long long len=0,cc[20] = {20},temp;
	while(num!=0){
		temp = num%10;
		cc[temp]++;
		len++;
		num/=10;
	}
	if(len == 1)
		cout<<1;
	else{
		if(temp == 9)
			cout<<(long long)(pow(10,len) - n);
		else
			cout<<(long long)((temp+1)*pow(10,len-1) - n);
	}
	return 0;
}

#include<iostream>
using namespace std;

int main(){

    int n, digit = 0, rem = 1, div = 10, num, pow = 1;

    cin >> n;

    while(rem != 0){
        rem = (n / div);
        div *= 10;
        digit++;
    }

    for (int i = 0; i < digit - 1; i++){
        pow *= 10;
    }

    num = (int)((n / pow) + 1) * pow;
    //cout << num << endl;
    cout << (int)num - n;

    return 0;
}

#include <iostream>
using namespace std;
int numOfNonZeros(long long int n)
{
	int x = 0;
	while (n)
	{
		if (n % 10 != 0)
			x++;
		n /= 10;
	}
	return x;

}
int size(long long int n)
{
	int counter = 0;
	while (n)
	{
		n /= 10;
		counter++;

	}
	return counter;
}
long long int ope(long long int n) {
	long long	int x = 10;
	long long	int w = (x - n % x) + n;
	n /= 10;
	n++;
	int e = numOfNonZeros(w);

	while (numOfNonZeros(w) != 1) {
		if (n % 10 != 0)
		{
			w += (10 - n % 10)*x;
			e--;
			n += 10;
		}
		x *= 10;
		n /= 10;

	}
	return w;
}
void luckyYear(long long int n)
{
	int d = size(n);
	if (numOfNonZeros(n) == 1 || numOfNonZeros(n) == 0)
	{
		long long w = pow(10.0, d - 1);
		cout << w;
	}
	else
	{
		long long int w = ope(n) - n;
		cout << w;
	}

}
void main()
{
	long long int Currentyear;
	cin >> Currentyear;
	luckyYear(Currentyear);

}

#include <iostream>
#include <stdio.h>
#include <cmath>
#include <math.h>
#include <algorithm>
#include <iomanip>
#include <string>
#include <vector>
#include <map>
#include <queue>
#include <stack>
#include <cstring>
#include <conio.h>
#include <windows.h>
#include <set>
#include <sstream>
using namespace std;

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

// i,j+1 | i+1,j | i-1,j | i,j-1
int di[] = {1, -1, 0, 0};
int dj[] = {0, 0, 1, -1};

// i+1,j+1 | i-1,j-1 | i+1,j-1 | i-1,j+1
int dii[]= {1,-1,1,-1};
int djj[]= {1,-1,-1,1};

int main(){

	string S;
	cin >> S;
	string T = S;
	if (T[0] == '9')
		T = "10" + T.substr(1);
	else
		T[0]++;

	for(int i=1;i<T.size();i++) T[i] = '0';

	int A,B;
	stringstream s;
	s << S; s >> A;
	s.clear();
	s << T; s >> B;

	cout << (B-A) << endl;

return 0;
}

#include <iostream>
#include <cstdio>
#define ll long long

using namespace std;

ll _maxi;
ll _ans = 1;
ll _num = 0;

void CParseIn () {
	scanf("%lld", &_maxi);
}

void Core () {

	ll res = _maxi;
	ll res2 = _maxi;

	while (res > 0) {
		_ans *= 10;
		_num = res % 10;
		res /= 10;
	}

	//cout<<'m';
//	while (res2 > 0) {
//		res2 /= 10;
//	}

	_ans /= 10;
	_ans *= (_num + 1);

	printf("%lld\n", _ans - _maxi);
}

int main () {

	CParseIn();
	Core();

	return 0;
}

#include<iostream>
#include<string>
#include<fstream>
#include<algorithm>
#include<cmath>
#include<map>
#include<vector>
using namespace std;
ofstream fo("test.out");
ifstream fi("test.inp");
int a[1000];
int n;
int Pow(int x)
{
	int p = 1;
	for (int i = 1; i <= x; i++)
		p *= 10;
	return p;
}
int main()
{
	cin >> n;
	int x = n, dem=0;
	while (!x%10)
	{
		x /= 10;
		dem++;
	}
	if (x < 10)
		cout << Pow(dem);
	else {
		int temp = x;
		x = n, dem = 0;
		while (x)
		{
			x /= 10;
			if (x) temp = x, dem++;
		}
		cout << (temp + 1)*Pow(dem) - n;
	}
}

#include<iostream>
#include<cmath>
#include<cstring>
using namespace std;

int main()
{
	int n;
	scanf("%d",&n);
	int len=log10(n);
	int tem=n;
	for(int i=0; i<len; i++)
		tem/=10;
	tem++;
	for(int i=0; i<len; i++)
		tem*=10;
	printf("%d\n",tem-n);
	return 0;
}

#include<bits/stdc++.h>

using namespace std;

int main()

{

	int n,m,k,l=0;

	scanf("%d",&n); m=n;

	while(m>=10)m/=10,l++; k=m+1;

	for(int i=0;i<l;i++)k*=10;

	printf("%d\n",k-n);

	return 0;

}

    #include<bits/stdc++.h>
    using namespace std;
    int main(){
    	string s; cin>>s;
    	int n =0;
    	for(int i =0; i<s.size(); i++){
    		n = n * 10 + s[i] - '0';
    	}
    	//cout<<"n = "<<n<<endl;
    	if(s.size() ==1){
    		cout<<1; return 0;
    	}
    	else if(s[0] !='9'){
    		int temp = s[0] - '0' + 1;
    		for(int i = 0; i + 1<s.size(); ++i){
    			temp *= 10;
    		}
    		cout<<temp - n;
    	}
    	else{
    		int temp =  1;
    		for(int i =0; i<s.size(); i++)
    		  temp *= 10;
    		cout<<temp - n;
    	}
    	return 0;
    }

#include <iostream>

int main() {
    long int year;
    std::cin >> year;

    long int start_year = year;

    long int last_number = 0;;
    long int wait = 0;
    int n_count = 0, n;
    long int time = 1;

    while (1) {
        last_number = year % 10;
        year /= 10;
        if (year > 0)
            time *= 10;
        else
            break;
    }

    time = time * (last_number + 1);
    wait = time - start_year;

    std::cout << wait << std::endl;

    return 0;
}

#include<stdio.h>
#include<math.h>
#include<string.h>
#include<stdlib.h>
int t(int n){
    int res = 1;
    for(int i = 1; i < n; i++){
        res *= 10;
    }
    return res;
}

int main()
{
    char a[10];
    while(~scanf("%s", a)){
        int l = strlen(a);
        if(l == 1) printf("1\n");
        else{
            int x = atoi(a);
            printf("%d\n", t(l)*(a[0]-'0'+1)-x);
        }
    }
return 0;
}
//2019-12-27 20:45:17.886

#include<cstdio>
#include<cmath>
int main(void)
{
    int n,ans;
    scanf("%d",&n);
    int t=n,ws=0,x;
    while(t!=0)
    {
        ws++;
        x=t%10;
        t/=10;
    }
    if (ws==1)
        ans=1;
    else{
        ans=x+1;
        for (int i=1;i<ws;i++)
            ans*=10;
        ans-=n;
    }
    printf("%d\n",ans);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int a=1e8;
int main(){
	int n;
	cin>>n;
    if(n==10*a){
        cout<<10*a<<endl;
        return 0;
    }
    if(n<a){
		for(int i=n+1;;i++){
			int x=i,k=0;
			while(x){
				if(x%10) k++;
				x/=10;
			}
			if(k==1){
				cout<<i-n<<endl;
				break;
			}
		}
	}
    else{
    	int b=n/a;
        cout<<(b+1)*a-n;
    }
    return 0;
}

#include <iostream>
#include <string>
#include <cmath>
#include <algorithm>
using namespace std;
int main(){

long long int n,kiek=0,sk=0,x,y,turibut=0,tarp=0;
cin >> n;

sk=0;
x=n;
y=n;

while(x){
sk++;
if(x<10)tarp=x;
x=x/10;
}

tarp++;
for(int i=1;i<sk;i++){
tarp=tarp*10;
}

kiek=tarp-n;

cout << kiek;
return 0;
}

#include <iostream>
#include <algorithm>
#include <set>
#include <cstdio>
#include <cstring>
#include <cmath>
using namespace std;
#define gcd(a,b) __gcd(a,b)

int n,t;
int solve(int n)
{

    char s[11];
    sprintf(s, "%d",n);
    int cnt = 0;
    for(int i=0;i<strlen(s);i++)
    {
        if(s[i] != '0')
            cnt++;
    }
    return cnt;
}
int Pow(int m)
{
    int res = 1;
    for(int i=0;i<m;i++)
        res*=10;
    return res;
}
int wei(int n)
{
    int cnt = 0;
    while(n)
    {
        n/=10;
        cnt++;
    }
    return cnt-1;
}
int main()
{
    while(cin>>n)
    {
        int m = wei(n);
        int p = Pow(m);
        cout<<(n/p+1)*p-n<<endl;
    }
}

#include <cmath>
 #include <iostream>
 using namespace std;

 int main()
 {
      int i;

      cin >> i;

     int n = i;
     int first = 0;
     int k = 0;
      while(n>0)
    {
        first=n%10;
        n=n/10;
        k++;
    }
    if ( k == 1  || i == 0)
    {
         cout << 1;
         return 0;
    }
    long l =  (first + 1)* pow(10, k - 1 ) - i;
    cout << l;

      return 0;
 }

#include<stdio.h>
#include<algorithm>
#include<string.h>
#include<math.h>
using namespace std;

const int mx=100005;

int main()
{
    int n,t,m;
    scanf("%d",&n);
    t=n;
    m=1;
    while(t)
    {
        if(t<10)
        {
            m=(t+1)*m;
            break;
        }
        m*=10;
        t/=10;
    }
    printf("%d\n",m-n);
}
/*2018-07-21 19:59:38.995*/

#include <iostream>
using namespace std;

int main() {
	// your code goes here

	long long i,j,k,n,temp,ans=1;
	cin>>n;
	temp=n;
	while(temp>=10)
	{
		ans=ans*10;
		temp=temp/10;
	}

	ans*=temp%10+1;
	cout<<ans-n;

	return 0;
}

#include <iostream>

using namespace std;

int main ()
{
  long long n;
  long long dcount = 0;
  long long x;
  cin >> n;
  x = n;
  while (x > 0)
    {
      dcount++;

      x = x/10;
    }

  // cout << dcount << endl;

  long long d =1;
  for (int i = 0; i < dcount; i++)
    {
      d = d *10;
    }

  // cout << d << endl;

  // cout << d - n << endl;

  long long lucky =  (d-n)%(d/10);

  if ( dcount < 2)
    cout << "1" << endl;
  else if (lucky == 0)
    cout << d/10 << endl;
  else
    cout << (d-n)%(d/10) << endl;

  return 0;
}

// 1495217207767

#include <iostream>
#include <cstdio>
#include <algorithm>
#include <cmath>
#include <cstring>
#include <string>
#include <vector>
#include <map>
#include <set>
using namespace std;

#define _ sync_with_stdio(false)
const int MAXN=100000+10;
const int INF=0x7fffffff;

long long n;

int main() {
	cin>>n;
	long long temp=n;
	long long t=1;
	long long x;
	while(temp){
		x=temp%10;
		temp/=10;
		t*=10;
	}
	t/=10;
	cout<<(x+1)*t-n<<endl;
}

#include<cstdio>
#include<iostream>
using namespace std;
int main(){
	int n,m;
	while(cin >> n){
	int co = 0;
	int ans = 0,v = 1,w;
	m = n;
	if(n < 10) ans = 1;
	if(n >= 10){
		while(1){
			if(n < 10) break;
			co++;
			n = n / 10;
		}
		n = m;
		for(int i = 0;i < co;i++){
			v = v * 10;
		}
		w = n / v;
		w++;
		ans = w * v - n;
	}
	printf("%d\n",ans);
	}
	return 0;
}

#include<iostream>
#include<cstdio>
#include<algorithm>
#include<cstring>
using namespace std;
#define ll long long
#define rep(i,a,b) for(int i=(a);i<(b);++i)
#define maxn 200
char s[maxn];
int ans=0;

int pow(int a,int b){
    int ans=1;
    for(int i=0;i<b;i++){
        ans*=a;
    }
    return ans;
}

int main(){
//    freopen("in.txt","r",stdin);
    scanf("%s",s);
    int n=strlen(s);

    rep(i,0,n) ans+=int(s[i]-'0')*pow(10,n-i-1);

    int pp;
    if(n==1)
        pp=1;

    else{
        int kk=1;
        if(s[0]=='9'){
           kk=pow(10,n);
        }
        else {
            kk=int(s[0]-'0'+1)*pow(10,n-1);
        }
        pp=kk-ans;
    }
    cout<<pp<<endl;
    return 0;
}

#define _CRT_SECURE_NO_WARNINGS
#include<iostream>
#include<iomanip>
#include<iterator>
#include <cstdio>
#include <vector>
#include <string>
#include <numeric>
#include <cmath>
#include <algorithm>
#include <set>
#include <map>
#include <deque>
#include <queue>
#include <stack>
#include<utility>
using namespace std;
typedef long long ll;
typedef long double ld;
typedef pair<int, int> pii;
typedef pair<double, double> pdd;
typedef vector<int> vi;
typedef vector<ll> vll;
typedef vector<double> vd;
typedef vector<ld> vld;
typedef vector<pii> vpii;
typedef vector<pdd> vpdd;
typedef vector<string> vs;
typedef set<int> si;
typedef multiset<int> Si;
typedef map<int, int> mi;
typedef multimap<int, int> Mi;
void read(char& a) { do scanf("%c", &a); while (isspace(a)); }
void write(const char& a) { printf("%c", a); }
char BUF[1234560];
void read(string& a) { scanf("%s", BUF); a = string(BUF); }
void write(const string& a) { printf("%s", a.c_str()); }
void read(int& a) { scanf("%d", &a); }
void write(const int& a) { printf("%d", a); }
void read(ll& a) { scanf("%I64d", &a); }
void write(const ll& a) { printf("%I64d", a); }
void read(double& a) { scanf("%lf", &a); }
void write(const double& a) { printf("%lf", a); }
void read(ld& a) { scanf("%Lf", &a); }
void write(const ld& a) { printf("%Lf", a); }
void read(pair<int, int>& a) { scanf("%d%d", &a.first, &a.second); }
void write(const pair<int, int>& a) { printf("%d %d", a.first, a.second); }
template<template<typename T, typename A = allocator<T> > class C, class T>
void read(C<T>& a) { for (auto i = a.begin(); i != a.end(); ++i) read(*i); }
template<template<typename T, typename A = allocator<T> > class C, class T>
void write(const C<T>& a) { int sz = a.size(); if (sz != 0) write(a[0]); for (int i = 1; i < sz; ++i) { write(' '); write(a[i]); } }
template<typename T1, typename T2>
void read(T1& t1, T2& t2) { read(t1); read(t2); }
template<typename T1, typename T2>
void write(const T1& t1, const T2& t2) { write(t1); write(' '); write(t2); }
template<typename T1, typename T2, typename T3>
void read(T1& t1, T2& t2, T3& t3) { read(t1); read(t2); read(t3); }
template<typename T1, typename T2, typename T3, typename T4>
void read(T1& t1, T2& t2, T3& t3, T4& t4) { read(t1); read(t2); read(t3); read(t4); }
template<typename T1, typename T2, typename T3>
void write(const T1& t1, const T2& t2, const T3& t3) { write(t1); write(' '); write(t2); write(' '); write(t3); }
template<template<typename T, typename A = allocator<T> > class C, class T>
void sort(C<T>& a) { sort(a.begin(), a.end()); }
template<template<typename T, typename A = allocator<T> > class C, class T>
void rsort(C<T>& a) { sort(a.rbegin(), a.rend()); }
template<typename T>
int sz(const T& a) { return int(a.size()); }
#define MX 1000000000
#define all(a) (a).begin(),(a).end()
#define rall(a) (a).rbegin(),(a).rend()
#define T(n) for(int _VARIABLE{(n) + 1}; --_VARIABLE;)
#define F(b,e,i) for(auto i = (b); i != (e); (b) < decltype(b)(e) ? ++i : --i)
#define G(f,l,i) for(auto i = (f) + ((f) < decltype(f)(l) ? -1 : 1); ((f) < decltype(f)(l) ? i++ : i--) != (l) ;)
#define M(f,l,i,j) for(auto i = (f) , j = decltype(f)(l) ; i < j; ++i, --j)
#define r(...) read(__VA_ARGS__)
#define R(type, ...) type __VA_ARGS__; r(__VA_ARGS__)
#define w(...) write(__VA_ARGS__)
#define W(...) write(__VA_ARGS__), write('\n')
#define bgn begin()
#define rbgn rbegin()
#define nd end()
#define rnd rend()
#define pb push_back
#define fnt front()
#define bck back()
#define x first
#define y second

int main()
{
#ifndef ONLINE_JUDGE
	freopen("input.txt", "r", stdin); freopen("output.txt", "w", stdout);
#endif
	R(int, n);
	int N{ n }, i{ 1 }, last;
	while (last = n % 10, n /= 10)
		i *= 10;
	W(++last * i - N);
}
//
// ArtemParkhomets
//

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

 int main(){
  int x , cp , y;
  long long New = 1;
  scanf( "%d" , &x );
  cp = x;

     while( x ){
      y = x % 10;
      x /= 10;
      New *= 10;
    }

  long long Ans;

     if( y == 9 )
      Ans = ( 1LL * New ) - cp;
     else{
      New /= 10;
      Ans = ( 1LL * ( y + 1 ) * New ) - cp;
    }

  printf( "%I64d\n" , Ans );
  return 0;
}

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

    int main(){
        int n, cont = 1;
        cin >> n;
        int aux = n;
        while(1){
            if(aux / 10){
                aux /= 10;
                cont *= 10;
            }else{
                break;
            }
        }
        cout << ((aux + 1) * cont) - n << endl;

        return 0;
    }

// 1496113315989

#include <iostream>
#include<string>
#include <cstdlib>
#include <sstream>
#include <cstdio>
#include <cmath>
#include <iomanip>
using namespace std;
int main()
{
	long long int N, A = 1, B = 0;
	cin >> N;
	while (A <= N)  A *= 10;
	A /= 10;
	while (B <= N) B += A;
	cout << B - N << endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
    int n,m,c=1;
    cin>>n;
    m=n;
    while(m>=10){
        m/=10;
        c++;
    }
    printf("%.0f",(m+1)*pow(10,c-1)-n);
}

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <cstdio>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <map>
#include <set>
#define PII pair<int, int>
#define PFF pair<float, float>
#define PDD pair<double, double>
#define MP make_pair
#define RI(X) scanf("%d", &(X))
#define RII(X,Y) scanf("%d %d", &(X), &(Y))
#define RD(X) scanf("%lf", &(X))
#define RDD(X,Y) scanf("%lf %lf", &(X), &(Y))
#define RF(X) scanf("%f", &(X))
#define RFF(X,Y) scanf("%f %f", &(X), &(Y))
#define RL(X) scanf("%I64d", &(X))
#define RLL(X,Y) scanf("%I64d %I64d", &(X), &(Y))
#define LL long long
#define MIN(X,Y) (X)<(Y)?(X):(Y)
#define MAX(X,Y) (X)>(Y)?(X):(Y)
#define INFD 1e32
#define PI 3.14159265358979323
#define eps 1e-6
using namespace std;
int main(){
  int n;
  RI(n);
  int base = log10(n) + eps;
  int num = n / pow(10, base);
  printf("%d\n", (num + 1) * int(pow(10, base) + eps) - n);
  return 0;
}

#include <bits/stdc++.h>
#define l n.size() - 1

using namespace std;

int main()
{
	int ans = 1;
	string n;

	cin >> n;

	if(n.size() == 1)
		return cout << 1 << endl, 0;

	for(int i = 0; i < l; ++i)
		ans *= 10;

	cout << ans - (n[l] - '0') << endl;

	return 0;
}

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

#define ll long long
#define f(i, x, n) for(int i = x; i < (int)(n); ++i)
#define all(c) (c).begin(), (c).end()
#define speed ios::sync_with_stdio(0); cin.tie(0);

int const N = 1e5 + 2, MOD = 1e9 + 7;
set <int> s[27];
vector<char> v;

int main(){
	speed
	int x;
	cin >> x;
	x++;
	string z = to_string(x);
	f(i, 0, z.size())if (i == 0){
		if (z[i] != '9')cout << (char)(z[i] + 1); else cout << "10";
	} else cout << "0";
}

#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

unsigned long long int year, digit = 0, temp, i;

int main()
{

	cin >> year;

	if (year > 1000000)
	{
		temp = year;
		for (int j = 0; temp != 0; ++j)
		{
			temp /= 10;
			++digit;
		}

		--digit;

		year = pow(10, digit) + 1;

		cout << year << endl;

	}

	else
	{
		for (i = year + 1; digit != 1; ++i)
		{
			temp = i;
			digit = 0;

			while (temp != 0)
			{
				if (temp % 10 != 0)
					++digit;

				if (digit > 1)
					break;

				temp /= 10;
			}

		}

		cout << i - year - 1 << endl;
	}

	return 0;
}

#include <iostream>
#include <vector>
#include <algorithm>
#include <deque>
#include <iomanip>
#include <cmath>
#include <queue>
#include <string>
using namespace std;

int main()
{
	int n;
	cin >> n;
	vector<int>a;
	for (int i = 0; i < 10; i++) {
		for (int j = 1; j < 10; j++)
			a.push_back(j*pow(10, i));
	}
	int next = *upper_bound(a.begin(), a.end(), n);
	cout << next - n;
}

//
//  main.cpp
//  A. Счастливый год
//
//  Created by Андрей Москалёв on 18.05.17.
//  Copyright © 2017 Андрей Москалёв. All rights reserved.
//

#include <iostream>

using namespace std;

int main(int argc, const char * argv[]) {
    string s, s1 = "";
    cin >> s;
    int zero_cnt = s.size() - 1;
    if (s.size() == 1) {
        cout << 1;
        return 0;
    }
    if (s[0] == '9') {
        s1 += "10";
    }
    for (int i = 0; i < zero_cnt; ++i) {
        s1 += '0';
    }
    int a = stoi(s), b = stoi(s1);
    cout << b - a;
    return 0;
}

#include<stdio.h>
#include<math.h>
#include<stdlib.h>
#include<string.h>

int main()
{
	int n;
	scanf("%d",&n);

	int nn = n;
	int cnt=0;
	int tmp;

	while(n)
	{
		cnt++;
		tmp = n%10;
		n/=10;
	}

	if(cnt==1)
		printf("1\n");
	else
		{
			int ans = (int)pow(10,cnt-1)*(tmp+1) - nn;
			printf("%d\n",ans);
		}
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, a, b) for(ll i=a; i<b; i++)
#define ffi For(i, 0, N)
#define ffj For(j, 0, Q)
#define ffa ffi ffj
#define s <<" "<<
#define w cout
#define e endl
#define pb push_back
#define mp make_pair
#define a first
#define b second
//500,000,000 operations
//Global Variables
ll N;

ll num_digits(ll K) {
    ll out = 0;
    while (K > 0) {
        out++;
        K /= 10;
    }
    return max((ll)1, out);
}

int main() {
	//ifstream cin ("test.in");
	cin >> N;
	ll N2 = N+1;
	ll D = num_digits(N2);
	for (ll i=10; i<pow(10.0, D); i*=10) {
        //w<< i s N2<<e;
        if (i > N) break;
	    N2 += i-(N2%i);
	    //w<< N2<<e;
	}
	w<< N2-N<<e;
}

#include <iostream>
using namespace std;

int main() {
    int n; cin >> n;
    int x = 1, tmp = n;
    while(tmp) {
        x *= 10;
        tmp /= 10;
    }
    cout << ((n/x)+1)*x - n;
}

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

#define ll long long
#define f(i, x, n) for(int i = x; i < (int)(n); ++i)
#define all(c) (c).begin(), (c).end()
#define speed ios::sync_with_stdio(0); cin.tie(0);

int const N = 1e5 + 2, MOD = 1e9 + 7;
set <int> s[27];
vector<char> v;

int main(){
	speed
	int x;
	cin >> x;
	x++;
	string z = to_string(x);
	if (z.size() == 1)return cout << x, 0;
	f(i, 0, z.size())if (i == 0){
		if (z[i] != '9')cout << (char)(z[i] + 1); else cout << "10";
	} else cout << "0";
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
typedef vector<int> vi;
#define pb push_back
#define mp make_pair
#define fast_io ios_base::sync_with_stdio(0);
#define show(x) cout<<x<<endl;
#define disp(x,y,z) cout<<x<<" "<<y<<" "<<z<<endl;
ll MOD=1e9+7;
ll MAX=1e17;

int main(){
	fast_io;
	int n;
	cin>>n;
	if(n==1000000000){
		show(n);
		return 0;
	}
/*	int s=0,m=n;
	while(m!=0){
	    s++;
	    m=m/10;
	}
	s--; */
	int s = (int)log10(n);
   // disp(n,m,s);
	int h = n;
	for (int i = 0; i < s; ++i)
	{
		h=h/10;
	}
	show(h);
	h++;
	//h = h*pow(10,s);
	while(s--) h=h*10;
	show(h);
	int y = h-n;
	show(y);
	return 0;
}

/*
    Rem is cute :D
*/

# include <bits/stdc++.h>

using namespace std;

#define pii pair<int, int>
#define pll pair<ll, ld>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mine *min_element
#define maxe *max_element
#define fi first
#define se second

#define y0 asjdlksajldjals
#define y1 ajsldjalksdkjlk

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int inf = (int)1e9 + 7;
const int maxn = (int)6e5 + 7;
const int lmaxn = (int)6e6 + 7;
const ll linf = (ll)1e16 + 7;

const ld eps = ld(1e-11);

const ll dx[] = {-1, 0, 0, 1, -1, 1, -1, 1};
const ll dy[] = {0, -1, 1, 0, -1, -1, 1, 1};
const char cd[] = {'a', 'b', 'b', 'a'};
ll gcd(ll a, ll b){
    while(b) a %= b, swap(a, b);
    return a | b;
}

ll lcm(ll a, ll b){
    return a * b / gcd(a, b);
}
bool isprime(ll x){
    ll q = 0;
    for(ll i = 2; i * i <= x; i++){
        if(x % i == 0){
            return false;
        }
    }
    return true;
}

ll n, m, q = 1, pos;
pair < ll, pll > p[maxn];
set < pair < pair < ll, pll >, ll > > b, g, v;
int main(){
   cin >> n;
   if(n < 10){
      cout << 1;
      return 0;
   }
   if(n == 1e9){
      cout << 2e9 - 1e9;
   }
   if(n >= 9e8){
      cout << 1e9 - n;
      return 0;
   }
   if(n >= 9e7){
      cout << 1e8 - n;
      return 0;
   }
   if(n >= 1e8){
      cout << n / 1e8 * 1e8 - n;
   }
   if(n >= 1e7){
      cout << n / 1e7 * 1e7 - n;
   }
   for(ll i = n + 1; i <= 1e9; i++){
      for(ll j = 1; j <= 9; j++){
         if((i / q) % 10 != 0)
            pos++;
         q *= 10;
      }
      if(pos == 1){
         cout << i - n;
         return 0;
      }
      q = 1;
      pos = 0;
   }
   return 0;
}

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;
int main(){
  string year;
  cin >> year;
  if (year.length() == 1 || stol(year)%10 == 0){
    cout << 1;
    return 0;
  }
  long fin = stol(year);
  year[0]++;
  for (int i = 1; i < year.length(); i++){
    year[i]='0';
  }
  long result = stol(year);
  result = result%fin;
  cout << result;
}

#include <bits/stdc++.h>
using namespace std;
int main() {
    ios::sync_with_stdio(false);
    cin.tie(0);
    int n;
    cin>>n;
    int t=n,m=log(n)-1;
    t=1;
    while(m--){
        t=t*10;
    }
    for(int i=2;i<=10;i++){
        if(t*i>n){
            cout<<t*i-n<<endl;
            break;
        }
    }
    return 0;
}

#include <stdio.h>
#include <math.h>
#include <iostream>
using namespace std;

int main(){
	int n=0,res=0;
	while(scanf("%d",&n)==1){
		res=0;
		int  temp=n;
	int sum=0;
	int fir=0;
	while(temp){
        sum++;
        fir=temp;
        temp/=10;
    }
	if(sum==1||sum==0){
		res=1;
	}
	else{
		res=(fir+1)*pow(10,sum-1)-n;
	}
	cout<<res<<endl;

		n=0;

	}

	return 0;

}

#include<bits/stdc++.h>
using namespace std;
string tostring(int);
string update(string );
main()
{
	int n;
	cin>>n;
	string str=tostring(n);
	reverse(str.begin(),str.end());
	string p=update(str);
	int ju=atoi(p.c_str());
	cout<<ju-n<<endl;
}
string tostring(int n)
{
	string res="";
	while(n)
	{
		int p=n%10;
		res.push_back(p+'0');
		n=n/10;
	}
	return res;
}
string update(string str)
{
	str[0]=str[0]-'0'+'1';
	for(int i=1;i<str.size();i++)
	{
		str[i]='0';
	}
	return str;
}

#ifdef ONLINE_JUDGE
#include <bits/stdc++.h>
#endif

#include <iostream>
#include <cmath>
#include <vector>
using namespace std;
const int N = 1e6+10;
string s;

int main()
{
	cin >> s;
	int i = s[0] - '0';
	int l = s.length();
	int nxt = (i+1)*pow(10, l-1);
	cout << nxt - stoi(s);

	return 0;
}

#include <iostream>
#include <cmath>
using namespace std;

int main() {
	long long num,a,digit,first;
	cin>>num;
	a=num;
	digit=0;
	while (a!=0){
		a/=10;
		digit++;
	}
	first=num/pow(10,digit-1);
    cout<<(first+1)*pow(10,digit-1)-num<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
string s,a;
ll i,j,m,n,p,q,r,l;
int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0);
    cin>>n;
    stringstream ss;
    ss<<n;
    ss>>s;
    l=s.size();
    for(i=0;i<l;i++)
    {
        if(i==0)
            a+=(s[i]+1);
        else
            a+='0';
    }
    stringstream ss1;
    ss1<<a;
    ss1>>m;
    cout<<abs(n-m);
}

#include <iostream>
#include <cmath>
using namespace std;
int n, ans = 1;
int main(){
	cin >> n;
	if (n < 10) {
		cout << ans;
		return 0;
	}
	int a = floor(log10(n)) + 1;
	int b = pow(10, a);
	int c = (n % b) / pow(10, a - 1) + 1;
	int nn = ((b/10) * c) - n;
	cout << nn;
	return 0;
}

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

int main()
{
long int n;
cin>>n;
if(n<10)
{
cout<<1;
exit(0);
}
long int x=n,z;
int count=0;
while(x>0)
{
z=x%10;
x=x/10;
count++;
}
if(z<9){
cout<<(z+1)*pow(10,count-1)-n;
}
else if(z==9)
{
cout<<pow(10,count)-n;
}
return 0;
}

#include <bits/stdc++.h>
using namespace std;
// 287644PV
#define FIXED_FLOAT(x) std::fixed <<std::setprecision(10)<<(x)
const int mod = 1000000007;

void addSelf(int&x, int y)
{
    x+= y;
    if(x >= mod)
        x-=mod;
}
void subSelf(int&x, int y)
{
    x -= y;
    if(x < 0)
        x += mod;
}

int gcd(int a, int b)
{
    if(b == 0)
        return a;
    else
        return gcd(b,a%b);
}

int main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    string n;
    cin >> n;
    if(stoi(n) <= 9)
        cout << 1;
    else{
        if(n[0] == '9')
            cout << pow(10,n.size()) - stoi(n);
        else
            cout << (n[0]-'0'+1)*pow(10,n.size()-1) - stoi(n);
    }

return 0;
}

//Bismillahir Rahmanir Rahim
#include<bits/stdc++.h>
#define ll              long long
#define ull             unsigned long long
#define pb              push_back
#define fastread()      (ios_base:: sync_with_stdio(false),cin.tie(NULL));
using namespace std;
int main()
{
    fastread();
    ll n,ans = 0,mod = 0,div = 0;
    cin>>n;
    if(n < 100){
        mod = n % 10;
        div = n / 10;
        if(mod == 0){
            ans = n;
        }
        else if(mod < 5){
            div = n / 5;
            ans = ((div+1) * 5 - n);
        }
        else{
            ans = ((div+1) * 10 - n);
        }
    }
    else if(n < 100){
        ans = 100 - n;
    }
    else if(n < 1000 && n > 100){
        div = n / 100;
        ans = ((div+1) * 100) - n;
    }
    else if(n >= 1000){
        div = n / 1000;
        ans = ( (div+1) * 1000) - n;
    }
    cout<<ans<<endl;
    return 0;
}

#include <iostream>
#include <string>
#include <vector>
#include <queue>
#include <cstdio>
#include <stdlib.h>
#include <cstring>
#include <math.h>
#include <algorithm>
#include <map>
#include <set>
#define PII pair<int, int>
#define PFF pair<float, float>
#define PDD pair<double, double>
#define MP make_pair
#define RI(X) scanf("%d", &(X))
#define RII(X,Y) scanf("%d %d", &(X), &(Y))
#define RD(X) scanf("%lf", &(X))
#define RDD(X,Y) scanf("%lf %lf", &(X), &(Y))
#define RF(X) scanf("%f", &(X))
#define RFF(X,Y) scanf("%f %f", &(X), &(Y))
#define RL(X) scanf("%I64d", &(X))
#define RLL(X,Y) scanf("%I64d %I64d", &(X), &(Y))
#define LL long long
#define MIN(X,Y) (X)<(Y)?(X):(Y)
#define MAX(X,Y) (X)>(Y)?(X):(Y)
#define INFD 1e32
#define PI 3.14159265358979323
using namespace std;
int main(){
  int n;
  RI(n);
  int base = log10(n);
  int num = n / pow(10, base);
  printf("%d\n", (num + 1) * int(pow(10, base)) - n);
  return 0;
}

#include <iostream>
#include <string>
#include <math.h>
using namespace std;

int main(void) {
	string num;
	cin >> num;
	bool x = true;

	int years = 0;
	int totalYears = 0;
	if(num.length() == 1) {
		cout << 1;
		exit(0);
	}

	for(int i = 1; i < num.length(); i++) {
		totalYears += (10 - stoi(num.substr(i, 1))) * pow(10, num.length() - (i+1));
		x = false;
			if(i + 1 != num.length())
				if(stoi(num.substr(i+1, 1)) != 0)
					totalYears -= pow(10, num.length() - (i+1));
		if(stoi(num.substr(i,1)) != 0) {
			x = false;
		}
	}

	if(x) {
		cout << (stoi(num.substr(0,1)) + 1) * pow(10, num.length() - 1);
	}

	else {
		cout << totalYears;
	}

	return 0;
}

///In The Name Of Allah
#include <bits/stdc++.h>
#define in freopen("input.txt", "r", stdin)
#define out freopen ("output.txt", "w", stdout)
#define all(v) v.begin(),v.end()
#define mp make_pair
#define pb push_back
#define p_b pop_back
#define pf push_front
#define p_f pop_front
#define sc second
#define fr first
#define sws cin.sync_with_stdio(false); cin.tie(0);

#define REP(i, a, b) \
for (int i = int(a); i <= int(b); i++)
#define TRvi(c, it) \
for (vi::iterator it = (c).begin(); it != (c).end(); it++)
#define TRvii(c, it) \
for (vii::iterator it = (c).begin(); it != (c).end(); it++)
#define TRmsi(c, it) \
for (msi::iterator it = (c).begin(); it != (c).end(); it++)

    #define INF 2000000000

using namespace std;

typedef long long ll;
typedef vector<int> vi;
typedef pair<int, int> ii;
typedef vector<ii> vii;
typedef set<int> si;
typedef map<string, int> msi;

int a[100001];

bool mtest = 0;
int TE=1;
int solve(){
    int n;
    cin >> n;
    int p =n;
    int k;
    int cnt = 0;
    while (p>0){
        k=p%10;
        p/=10;
        cnt++;
    }
       k++;
       cout << k - n;
       return 0;
}
int main () {
     sws;
 //in; out;
   if (mtest)
    cin >> TE;

   while (TE--){
   solve();
   }
return 0;
}

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

int main(int argc, char **argv)
{
	long n; cin >> n;
    //n = 100000;
    long i = 0, m = n, l;
    for (;m>0;m/=10,++i) {

        l=m;
        //cout << m << '\t' << i << '\t' << l << endl;
    }
    //cout << m << '\t' << i << '\t' << l << endl;
    //cout << n << endl;
    //cout << pow(10,i-1) * (l+1) - n << endl;

    long nxt = pow(10,i-1) * (l+1);
    cout << nxt - n << endl;
	return 0;
}

#include <unordered_map>
#include <vector>
#include <iostream>
#include <utility>
#include <functional>

using namespace std;

void solve(int n)
{
    int orig_n = n;
    int pow = 0;
    int m = 1;

    while(n/10 != 0)
    {
        n /= 10;
        pow++;
    }

    for(int i=0; i<pow; i++)
        m *= 10;
    m = (n + 1)*m;

    cout << (m - orig_n) << endl;
}

int main()
{
    int c;

    cin >> c;
    for(int i=0; i<c; i++)
    {
        int n;
        cin >> n;
        solve(n);
    }

    return 0;
}

// 1495214414633

#include <iostream>
#include <math.h>
using namespace std;

typedef long long int LLI;

int left_digit(int n) {
    if (n < 10) return n;
    return left_digit(n/10);
}

int number_of_digits(int n) {
    if (n < 10) return 1;
    return 1 + number_of_digits(n/10);
}
/*
int main() {
    int current_year;
    cin >> current_year;
    LLI next_lucky_year = (LLI)(left_digit(current_year) + 1) * pow(10, number_of_digits(current_year)-1);
    cout << next_lucky_year - current_year << endl;
}
*/
int main() {
    int n;
    cin >> n;
    LLI next_lucky_year = (left_digit(n) + 1) * pow(10, number_of_digits(n)-1);
    cout <<  next_lucky_year - (LLI) n << endl;
}

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

int main()
{
	long long n;
	cin>>n;
	if(n>=1&&n<10)
	{
	//	cout<<"yo"<<endl;
		cout<<1<<endl;
		return 0;
	}
	int temp=n;
	int count=0;
	while(n)
	{
		n/=10;
		count++;
	}
	n=temp;
	int x=count;
	//int x=log10(n)+1;
	int yy=x-1;
	int p=pow(10,yy);
	//cout<<p<<endl;
	int fd=n/p;

	//cout<<fd<<endl;
	//int u=(int)pow(10,yy);
	if(fd*p==n)
		{
			cout<<p<<endl;
			return 0;
		}
	int sd=fd+1;
	int ll=sd*p;
	cout<<ll-n<<endl;
	return 0;
}

#include <iostream>
#include <cstdio>
#include <math.h>
using namespace std;

int main() {
	int cur_year;
	int power = 0;

	cin >> cur_year;

	int cur_year_aux = cur_year;

	while (cur_year_aux/10 > 0) {
		power++;
		cur_year_aux /= 10;
	}

	int first_digit = cur_year_aux;
	int next_lucky_year = (first_digit+1) * pow(10, power);
	int diff = next_lucky_year - cur_year;

	printf("%d", diff);

	return 0;
}
// 1495217058385

#include<iostream>
using namespace std;

int main()
{
    int n,rem=0,sum=0;
    cin>> n;

    while(n>100&&n<1000)
    {
        rem=n%100;
        sum=100-rem;
        n=n/100;
    }
    while(n>1000)
    {
        rem=n%1000;
        sum=1000-rem;
        n=n/1000;
    }
    while(n>=1&&n<10)
    {
            rem=n%10;
            sum=5-rem;
            n=n/10;

    }
    cout<< sum <<endl;
    return 0;
}

/*
    Rem is cute :D
*/

# include <bits/stdc++.h>

using namespace std;

#define pii pair<int, int>
#define pll pair<ll, ld>

#define pb push_back
#define eb emplace_back
#define mp make_pair
#define mine *min_element
#define maxe *max_element
#define fi first
#define se second

#define y0 asjdlksajldjals
#define y1 ajsldjalksdkjlk

typedef long long ll;
typedef long double ld;
typedef unsigned long long ull;

const int inf = (int)1e9 + 7;
const int maxn = (int)6e5 + 7;
const int lmaxn = (int)6e6 + 7;
const ll linf = (ll)1e16 + 7;

const ld eps = ld(1e-11);

const ll dx[] = {-1, 0, 0, 1, -1, 1, -1, 1};
const ll dy[] = {0, -1, 1, 0, -1, -1, 1, 1};
const char cd[] = {'a', 'b', 'b', 'a'};
ll gcd(ll a, ll b){
    while(b) a %= b, swap(a, b);
    return a | b;
}

ll lcm(ll a, ll b){
    return a * b / gcd(a, b);
}
bool isprime(ll x){
    ll q = 0;
    for(ll i = 2; i * i <= x; i++){
        if(x % i == 0){
            return false;
        }
    }
    return true;
}

ll n, m, q = 1, pos;
pair < ll, pll > p[maxn];
set < pair < pair < ll, pll >, ll > > b, g, v;
int main(){
   cin >> n;
   if(n < 10){
      cout << 1;
      return 0;
   }
   if(n == 1e9){
      cout << 2e9 - 1e9;
   }
   if(n >= 9e8){
      cout << 1e9 - n;
      return 0;
   }
   if(n >= 9e7){
      cout << 1e8 - n;
      return 0;
   }
   if(n >= 1e8){
      cout << ((n / 1e8) + 1) * 1e8 - n;
      return 0;
   }
   if(n >= 1e7){
      cout << ((n / 1e7) + 1) * 1e7 - n;
      return 0;
   }
   cout << 1;
   for(ll i = n + 1; i <= 1e9; i++){
      for(ll j = 1; j <= 9; j++){
         if((i / q) % 10 != 0)
            pos++;
         q *= 10;
      }
      if(pos == 1){
         cout << i - n;
         return 0;
      }
      q = 1;
      pos = 0;
   }
   return 0;
}

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

int main(){
    long long int n, t;
    cin >> n;

    t = n;
    if (n < 10) {
        cout<<1;
        return 0;
    }

    long long int len = 0;
    while (t / 10 != 0) {
        t /= 10;
        len++;
    }
    t = n;
    n /= pow (10, len);
    //cout << (( n + 1) * pow (10, len)) - t;

    return 0;
}

#include<iostream>
#include<vector>
#define size 10
using namespace std;
int main()
{
	int arr[size];
	int arb[9] = { 10,100,1000,10000,100000,100000,10000000,100000000,1000000000 };
	long long int x;  cin >> x; int p = x;
	int num = 1;
	int i = 0;
	if (x < 10)
	{
		cout << 1;
		goto n;
	}
	while (x != 0)
	{
		arr[i] = x % 10;
		x = x / 10;
		i++;
	}

	int k = 0;
	for (int i = 0; i < size; i++)
	{
		if (arr[i] > -1)
			k++;

	}int mm;
	for (int i = 2; i<10; i++)
		if (k == i)
		{
			k = (arr[k - 1] + 1) * arb[i - 2];
			mm= k - p;
		}
	cout << mm;
n:return 0;
}

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

int main()
{
long long int n;
cin>>n;
if(n<10)
{
cout<<1;
exit(0);
}
long long int x=n,z;
int count=0;
while(x>0)
{
z=x%10;
x=x/10;
count++;
}
if(z<9){
long long int a=(z+1)*pow(10,(count-1))-n;
cout<<a;
}
else if(z==9)
{
long long int a=pow(10,count)-n;
cout<<a;
}
return 0;
}

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

int main(){
	ios_base::sync_with_stdio(false);
	int n;
	cin>>n;
	int i = n;
	int dig = 0;
	while(i){
		dig++;
		i /= 10;
	}

	int pick = 0, count = 0;
	int odig = dig;
	int inc = 0;
	if(dig == 1){
		cout<<"1"<<endl;
	}
	else
		pick = n / pow(10, dig-1);
		pick++;
		pick = pick * pow(10, dig-1);
		cout<<pick-n<<endl;
	return 0;
}

#include <cstdio>
#include <cstring>
#include <iostream>
#include <sstream>
#include <cmath>
#include <algorithm>
#include <string>
#include <stack>
#include <queue>
#include <vector>
#include <map>
using namespace std;

int main()
{
	int n;
	scanf("%d", &n);
	if(n < 10)
		printf("1\n");
	else if(n < 100)
		printf("%d\n", 10-n%10);
	else if(n < 1000)
		printf("%d\n", 100-n%100);
	else if(n < 10000)
		printf("%d\n", 1000-n%1000);
	else if(n < 100000)
		printf("%d\n", 10000-n%10000);
	else if(n < 1000000)
		printf("%d\n", 100000-n%100000);
	else if(n < 10000000)
		printf("%d\n", 1000000-n%100000);
	else if(n < 100000000)
		printf("%d\n", 10000000-n%10000000);
	else if(n < 1000000000)
		printf("%d\n", 100000000-n%100000000);
	else
		printf("128052320\n");
	return 0;
}

#include<iostream>
#include<vector>
#define size 10
using namespace std;
int main()
{
	int arr[size];
	int arb[9] = { 10,100,1000,10000,100000,100000,10000000,100000000,1000000000 };
	long long int x;  cin >> x; int p = x;
	int num = 1;
	int i = 0;
	if (x < 10)
	{
		cout << 1;
		goto n;
	}
	while (x != 0)
	{
		arr[i] = x % 10;
		x = x / 10;
		i++;
	}

	int k = 0;
	for (int i = 0; i < size; i++)
	{
		if (arr[i] > -1)
			k++;

	}
	for (int i = 2; i<10; i++)
		if (k == i)
		{
			k = (arr[k - 1] + 1) * arb[i - 2];
			cout << k - p;
		}

n:return 0;
}

#include <bits/stdc++.h>
using namespace std;
bool check(long long n) {
	int kol = 0;
	while (n) {
	//	int kol = 0;
		int x = n % 10;
		if (kol > 1) {
			return false;
		}
		if (x != 0) {
			kol++;
		}
		n /= 10;
	}
	return true;
}
int main () {
    ios_base :: sync_with_stdio(0);
	long long n;
	cin >> n;
	long long x = n;
	n++;;
	while (!check(n)) {
		n++;
	}
	cout << n - x;
	return 0;
}

#include <iostream>
#include<set>
#include<math.h>
#include<vector>
using namespace std;

int main()
{
    int a;
    int carry=0;
    int counts=0;
    int zero=0;
    int yr=0;
    std::vector<int> ans;
    std::vector<int>::iterator it;
    int temp;
    cin>>a;
    if(a<10)
    {
        cout<<"1";
    }
    else
    {
        while(a>9)
        {
            int t=a%10;
            a=a/10;
            if(carry==1)
            {
                t=t+1;
            }
            if(t!=0)
            {
                carry=1;
                counts=1;
            }
            else
            {
                carry=0;
                t=10;
            }
            ans.push_back(10-t);
        }
        if(counts!=1)
            cout<<"1";
      it=ans.end();
      it--;
      while(it!=ans.begin())
      {
       if(*it==0 && zero==1)
       cout<<*it;
       else if(*it!=0)
       {
           cout<<*it;
           zero=1;
       }
       it--;
      }
      cout<<*it;
    }
}

#include <iostream>
#include <algorithm>
#include <string>
using namespace std;

int arr[1005];
int main()
{
	int n;
	cin>>n;
	int num=n;
	int a=1;
	int t=1;
	while(num!=0)
	{
		a=num%10;
		num=num/10;
		t=t*10;
	}
	t=t/10*(a+1);
	cout<<t-n<<endl;
	return 0;
}

#include <bits/stdc++.h>
using namespace std;
typedef long long ll;
#define For(i, a, b) for(int i=a; i<b; i++)
#define ffi For(i, 0, N)
#define ffj For(j, 0, 4)
#define ffa ffi ffj
#define s <<" "<<
#define w cout
#define e endl
#define pb push_back
#define mp make_pair
#define a first
#define b second
//500,000,000 operations
//Global Variables
int N;

int num_digits(int K) {
    int out = 0;
    while (K > 0) {
        out++;
        K /= 10;
    }
    return out;
}

int main() {
	//ifstream cin ("test.in");
	cin >> N;
	int N2 = N+1;
	int D = num_digits(N2);
	for (int i=10; i<pow(10.0, D); i*=10) {
        //w<< i s N2<<e;
	    N2 += i-(N2%i);
	    //w<< N2<<e;
	}
	w<< N2-N<<e;
}

 #include <iostream>
 #include <cmath>
 using namespace std;
 int a[10];
 int main(){
 	string str;
 	cin>>str;
 	long long int n=str.size(),s=0;
 	for(int i=0;i<=n-1;i++)
 	a[i]=(int)(str[i]-'0');
 	for(int i=0;i<=n-1;i++)
 	s+=pow(10,n-1-i)*a[i];
 	int p=(int)(str[0]-'0');
 	int q=(p+1)*(pow(10,n-1));
 	long long int z=q-s;
 	cout<<z;
	  }

#include <bits/stdc++.h>

using namespace std;
   int b[63];

int main()

{
     int n;
     cin>>n;
    vector<int> v;
   for (int i=1 ;i<=9;++i)
    {
       v.push_back(i);

    }
    for (int i=1 ;i<=9;++i)
    {
       v.push_back(10*i);

    }
    for (int i=1 ;i<=9;++i)
    {
       v.push_back(10*i);

    }
    for (int i=1 ;i<=9;++i)
    {
       v.push_back(100*i);

    }
    for (int i=1 ;i<=9;++i)
    {
       v.push_back(1000*i);

    }
    for (int i=1 ;i<=9;++i)
    {
       v.push_back(10000*i);

    }
    for (int i=1 ;i<=9;++i)
    {
       v.push_back(100000*i);

    }
    for (int i=1 ;i<=9;++i)
    {
       v.push_back(1000000*i);

    }
    for (int i=1 ;i<=9;++i)
    {
       v.push_back(100000000*i);

    }
  int x= *upper_bound(v.begin() ,v.end() ,n);
  cout<<x-n;

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
long long int a;
cin>>a;
int n= floor(log10(abs(a))) + 1;
int h=a;

int lastd;
while(h>0)
{
lastd=h%10;
h=h/10;
}
if(lastd!=9){n=n-1;}
long long int upper=pow(10,n);upper=upper*(lastd+1);
if(a<10000)
{for(long long int i=a+1;i<=upper;i++)
{
int lcount=0;
int k=i;
while(k>0)
{
int h=k%10;
k=k/10;
if(h!=0)
{
lcount++;
}
}
if(lcount==1)
{
cout<<i-a;
break;
}
}
//flag=0;
}
else
{
if((n==1))
cout<<"1";
else
{
cout<<upper-a;
}}
return 0;
}

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

#define fast ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
#define ll long long
#define mp make_pair
#define ss second
#define ff first
#define pb push_back
#define PDI pair<double, int>

int n;

int main()
{
	fast;

	cin >> n;

	int d = n;
	int cnt = 0;
	int x;
	while(n != 0)
	{
		cnt ++;
		if((n / 10) == 0)
		x = n;
		n /= 10;
	}
	if(cnt == 1)
	{
		puts("1");

	}
	else

	{
	((x+1)*pow(10,cnt-1));

        cout<<	((x+1)*pow(10,cnt-1)) - d << endl;
	}

}

#include <iostream>
#include <cmath>
using namespace std;

int main(){

	int year;
	cin>>year;
	//cout<<year;
	int deg = int(log10(year));
	int first_num=year;
	for(int i=0;i<deg;i++){
		first_num = first_num/10;
	}

	cout<<int((first_num+1)*pow(10,deg)-year)<<endl;
	return 0;
}

#include<bits/stdc++.h>
using namespace std;
main(){
    long long int n,m;
    int count=0,ld;
    cin>>n;
    m=n;
    if(n<10){
        cout<<1;
        return 0;
    }
    while(m>10){
        m=m/10;
        count++;
//        cout<<m<<endl;
    }
	ld=m;
	ld++;
//    cout<<ld<<' '<<count<<endl;
    m=ld*pow(10,count);
    cout<<m-n;

}

#include<stdio.h>
#include<string.h>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<math.h>
using namespace std;
int main()
{
    int n,m;
    double s,a;
    cin>>n;
    m=n;
    if(n<10)
    {
        printf("1\n");
    }
    double sum=0;
    while(n>=10)
    {
        n=n/10;
        sum++;
    }
    s=pow(10,sum);
    //printf("%.lf\n",s);
    s=(n+1)*s;
    //printf("%.lf\n",s);
    a=s-m;
    printf("%.lf\n",a);
    return 0;
}

#include <bits/stdc++.h>

using namespace std;
typedef long long ll;
typedef long double ld;
typedef vector<ll> vlong;
#define vt vector;
#define pb push_back
#define sz(x) (int)(x).size()
int main()
{
	ll n;
	cin >> n;
	if(n < 10)
		{
			n=1;
			cout<<n;
			return 0;
		}
	ll temp=n;
	ll digit=0;
	while(temp != 0){
		temp/=10;
		digit++;
	}
	digit--;
	ll deno=1,ans=0;

	while (digit--)
	{
		deno*=10;
		if(n%deno != 0)
		{ll temp=deno-(n%deno);
		n+=temp;
		ans+=temp;}
	}
	cout<<ans;

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n;
	cin>>n;
	long long l=0,c,p=n;
	while(p!=0)
	{l++;
		c=p%10;
		p=p/10;
	}
	cout<<(c+1)*pow(10,l-1)-n;
return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
	int a[91];
	int i=1;
	int j,k;
	int n;
		a[0]=0;
	  for(j=0;j<=9;j++)
	  {
	  	for(k=1;k<10;k++)
	  	{
	  		a[i++]=pow(10,j)*k;
		  }
	  }

	while(scanf("%d",&n)!=EOF)
	{

		for(i=0;i<91;i++)
		if(a[i]>n) break;
		printf("%d\n",a[i]-n);
		printf("%d\n",a[i]);
	}
	return 0;
}

#include <iostream>
#include <math.h>
using namespace std;
int main(){
	int A[1];
double anho;
	cin>> anho;
	double b=0;
	int a=anho;
	if (anho>=10){
	while (a>=10){
			a=a/10;
			b++;
 }
 double x=((a+1)*pow(10,b)-anho);
 A[0]=x;
 cout<<A[0];
} else {cout<< 1;}
return 0;
}

#include <cmath>
 #include <iostream>
 using namespace std;

 int main()
 {
      int i;

      cin >> i;

     int n = i;
     int first = 0;
     int k = 0;
      while(n>0)
    {
        first=n%10;
        n=n/10;
        k++;
    }
    if ( k == 1 )
    {
         cout << 1;
         return 0;
    }
    cout << (first + 1)* pow(10, k - 1 ) - i;

      return 0;
 }

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

#define PI 3.1415926535897932384626433832795
#define MOD 1000000007
#define pb push_back
#define mp make_pair
#define FOR(i,x,y) for(int i=x;i<y;i++)
#define in(n) scanf("%d",&n)
#define out(n) printf("%d\n",n)
#define SORT(v)  sort(v.begin(), v.end())
#define SORTR(v) sort(v.rbegin(), v.rend())
#define MAX(v) *max_element(v.begin(), v.end())
#define MIN(v) *min_element(v.begin(), v.end())
#define FAST ios_base::sync_with_stdio(false)
typedef vector<int> vi;
typedef vector<vi> vvi;
typedef pair<int,int> ii;
typedef pair<int,ii> iii;
typedef vector<ii> vii;
typedef vector<vii> vvii;
typedef vector< iii > viii;
typedef long long ll;

int main(){
      FAST;
      int n,i=0,m;
      cin>>n;
      m=n;
      if(n==100000000){
          cout<<n;
          return 0;
      }
      while(m){
            m/=10;
            i++;
      }
      if(i==1){
            cout<<1;
            return 0;
      }
      int y= n/pow(10,i-1);
      cout<<(y+1)*pow(10,i-1) - n;
      return 0;
}

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

int main()
{
 long long n;
 cin>>n;

 long long k=n;
 int cnt=0;

 while(k/10)
 {
  k/=10;
  cnt++;
 }

 k=k+1;
 k=k*pow(10,cnt);

 cout<<k<<' ';

 cout<<k-n;

 return 0;
}

#include<iostream>
using namespace std;
int n,m,ans,dig,k,pch;
main()
{
      cin>>n;
      if(n<10){cout<<1;return 0;}
      m=n;
      dig=1;
      while(m!=0)
      {

                 k=10-(m%10);
                 ans+=k*dig;
                 pch=k*dig;
                 m/=10;
                 dig*=10;
                 }

                 cout<<ans-pch;

                // system("pause");
                 }

#include<iostream>
#include<cmath>
using namespace std;
int main()
{
    long long n;
    cin>>n;

    if(n<10){
        cout<<1<<endl;
        return 0;
    }
    int a[1000];
    int j=0,q=0;
    while(n){
        a[j]=n%10;
        n=n/10;
        if(a[j]!=0)q++;
        j++;
    }

    if(q==1){
        j=j-1;
        long long int k;
        k=pow(10, j);
        k=k+1;
        cout<<k<<endl;
     //   system("pause");
        return 0;
    }

    else{
        //  cout<<j<<endl;
          q=j-1;
          for(int i=0;q>=i;i++,q--){
              int d;
              d=a[i]+1;
              a[i]=a[q]+1;
              a[q]=d;
          }

         int b[1000];
         j=j-1;//j last is index no. last
         a[j]=a[j]-1;
         q=j-1;
       //  for(int i=0;i<=j;i++)cout<<a[i];

         for(int i=j;i>0;i--){
            b[q--]=10-a[i];
         }
        for(int i=0;i<=j-1;i++)cout<<b[i];
    }
   // system("pause");
    return 0;
}

#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,cnt,i,tmp;
	while(cin>>n) {
		cnt = 0;
		tmp = n;
		if(n < 10)
		{
			cout<<"1"<<endl;
			continue;
		}
		else {
			for(i = 10; n/i > 0; n/=10) {
				++cnt;
			}
			if(n != 0 && tmp % (int)pow(10,cnt) != 0)
				cout<< (n+1)*pow(10,cnt) - tmp <<endl;
			else cout<<"0"<<endl;
		}
	}
	return 0;
}

#include <algorithm>
#include <cctype>
#include <cmath>
#include <cstdio>
#include <cstdlib>
#include <cstring>
#include <ctime>
#include <iomanip>
#include <iostream>
#include <map>
#include <queue>
#include <string>
#include <set>
#include <vector>
#include <cassert>
#include <stack>
using namespace std;
typedef long long LL;
const int N = 1e6+7 , INF = 0x3f3f3f3f , MOD = 1e9+7;
const double PI = acos(0.0) * 2;
template<typename T1>
T1 gcd(T1 a , T1 b){ return b ? gcd(b,a%b) : a;}

int main(){
#ifdef LOCAL
//  freopen("F:\\c++\\in.txt", "r", stdin);
//  freopen("F:\\c++\\out.txt","w",stdout);
#endif
    int n;
    scanf("%d",&n);
    int t = 1;
    while( t*10 < n )   t*=10;
    n /= t;
    n++;
    n *= t;
    printf("%d\n",n);
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define nln printf("\n")

bool lucky_year(ll n)
{
    if(n==5)
    {
        return true;
    }

    ll j=n;
    ll c=0;
    ll l;
    while(j)
    {
        l=j%10;
        if(l!=0)
        {
            c++;
        }
        if(c>1) return false;
        j/=10;

    }

        return true;

}
int main()
{
   // if(n==100000000)  cout<<"200000000"; return 0;
    ll n;
    cin>>n;
    if(n==100000000)  cout<<"200000000"; return 0;

    n++;

    ll m=n;

    while(!lucky_year(n))
    {
        n++;
    }

    cout<<n-m+1;
}

// problem
//  Created by 聂小楠 on 2017/5/18.
//  All rights reserved.
//
#include<bits/stdc++.h>
#define ll long long
#define MAX_N 10005
#define Mem(a,b) memset(a,b,sizeof(a))
#define FREI freopen("in.txt","r",stdin);
#define FREO freopen("out.txt","w",stdout);
using namespace std;

const ll mod =1e9+7;
ll q_pow(int a,int n)
{
    ll res=1;
    while(n>0)
    {
        if(n&1) res*=a;
        a=a*a;
        n>>=1;
    }
    return res;
}
int main()
{
    ll num;
    int fi,se,ret;
    fi=se=0;
    bool flag=0;
    cin>>num;
    while(num){
        if(!flag)fi++;
        se++;
        if(num%10&&flag)break;
        if(num%10&&flag==0)flag=1,ret=num%10;

        num/=10;
    }
    if(se==fi)
        cout<<q_pow(10,se-1)<<endl;
    else
        cout<<q_pow(10,se-1)-ret*q_pow(10,fi-1)<<endl;
    return 0;

}

#include <bits/stdc++.h>
using namespace std;
int main()

{
int64_t x;
cin>>x;
double m=x;
double sum=0;
double s;
while(m>=10)
{m=m/10;
sum++;
}
int64_t b=pow(10,sum);
if(x/b==1)
{
    cout<<x;
    return 0;
}
if(x<10)
    cout<<1;

else
{s=x/pow(10,sum)+0.001;
s=ceil(s);
long long y =s*pow(10,sum)-x;
if(y>x)
{cout<<1;
return 0;

}
cout<<y;
}

}

#include <iostream>
#include <math.h>
#include <algorithm>
#include <array>
#include <vector>
#include <string>
using namespace std;
typedef long long ll;
typedef long double db;
typedef string str;
#define fs first
#define sc second
#define el endl
#define sz size

int main()
{
	ll a;
	cin >> a;
	cout << fixed;
	if (a >= 1e9) {
		cout << ll(((a / 1e9) + 1) * 1e9 - a);
		return(0);
	}
	if (a >= 1e8) {
		cout << ll(((a /1e8) + 1) * 1e8 - a);
		return(0);
	}
	if (a >= 1e7) {
		cout << ll(((a / 1e7) + 1) * 1e7 - a);
		return(0);
	}
	if (a >= 1e6) {
		cout << ((a / 1e6) + 1) * 1e6 - a;
		return(0);
	}
	if (a >= 1e5) {
		cout << ((a / 1e5) + 1) * 1e5 - a;
		return(0);
	}
	if (a >= 10000) {
		cout << ((a / 10000) + 1) * 10000 - a;
		return(0);
	}
	if (a >= 1000) {
		cout << ((a / 1000) + 1) * 1000 - a;
	}
	else {
		if (a >= 100) {
			cout << ((a / 100) + 1) * 100 - a;
		}
		else {
			if (a >= 10) {
				cout << ((a / 10) + 1) * 10 - a;
			}
			else {
				cout << 1;
			}
		}
	}
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main(){
	string s; cin>>s;
	if(s.size() ==1 && s[0]!= '9'){
		cout<<s[0] - '0' + 1;
	}
	else if(s =="9"){
		cout<<10;
	}
	else if(s[0] !='9'){
		cout<<s[0]-'0'+1;
		for(int i = 0; i + 1<s.size(); ++i){
			cout<<0;
		}
	}
	else{
		cout<<1;
		for(int i =0; i<s.size(); i++)
		  cout<<0;
	}
	return 0;
}

#include<stdio.h>
#include<math.h>
int main()
{
	int n;
	scanf("%d",&n);

	int len=0,a,m=n;
	while(n)
	{
		len++;
		if(n<10)
		a=n+1;
		n/=10;
	}
	a*=(int)(pow(10,len-1));
	printf("%d",a-m);
	return 0;
}

/*#include <iostream>
#include <algorithm>
#include <string>
using namespace std ;
int arr[100000],acc[100000],n;
pair <int,int> sorted[100000];
int bin_search(int s,int e,int val){
if(s >= e ){
    if(val == sorted[s].first) return sorted[s].second ;
        if(val == sorted[e].first) return sorted[e].second ;
    else return -1 ;
}
int mid = (s+e)/2 ;
if(val==sorted[mid].first) return sorted[mid].second ;
if( val > sorted[mid].first){
    return bin_search(mid+1,e,val);
}
else if(val < sorted[mid].first){
    bin_search(s,mid-1,val);
}
}
int main(){
    string out = "NO";
    cin >> n ;
    cin >> arr[0];
    acc[0]= arr[0];
    for(int i=1;i<n;i++){
       cin>> arr[i];
       sorted[i].first = arr[i];
       sorted[i].second = i ;
       acc[i]= acc[i-1]+ arr[i];
    }
    sort(sorted,sorted+n);
    int temp=0,index =0;
        for(int i=0;i<n;i++){
            cout << acc[i]<< "\t"<< acc[n-1]-acc[i] << "\t" << i << endl ;
        if(!((2*acc[i]-acc[n-1])%2))
        index = bin_search(0,n,(2*acc[i]-acc[n-1])/2 );
        if(acc[i]== (acc[n-1]-acc[i]) ){
                cout << "no replacments"<< endl;
               out= "YES";
                break ;
        }
        else if(acc[i] > acc[n-1]-acc[i]){

        if(index >=0 && index <=i){
            cout << "in the first half "<< arr[index]<<"\t"<< index << endl ;
            out="YES";
            }
        }
        else if (arr[i] < acc[n-1]-acc[i]){
            if(index > i && index < n ){
                cout << "in the second half "<< arr[index]<<"\t"<< index << endl ;
                out = "YES";
                }
        }
    }
    cout << out << endl;

    return 0;
 }
*/
#include <iostream>
#include <algorithm>
#include <string>
#include <cmath>

using namespace std ;

int main(){

    long int year , n  , nextyear ;

    int temp , count = 0;

    cin >> year ;

    if(year < 10)   cout << "1" ;

    else{

        n = year ;

        while(n > 0){

            temp = n % 10 ;

            n = n / 10 ;

            count++;
        }

        //cout << ((temp+1)*(pow(10,(count-1)))) << endl << endl ;

        cout << fixed <<(long double)( ((temp+1)*(pow(10,(count-1)))) - year) ;
    }

    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int xarisxi(int x){
	int p=1;
	for(int k=1;k<=x;k++) p*=10;
	return p;
}
int n,i,d,r;
int main(){
	cin>>n;
	i=n;
	if(n<10) cout<<n+1;
	else {

	while(i>0){ i=i/10; d++;}
	cout<<(n/xarisxi(d-1)+1)*xarisxi(d-1)-n;

}

	return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
    int n,b=1, a;
    cin>>n;
    a=n;
    while(n>9)
    {
        n/=10;
        b*=10;
    }
    cout<<(n+1)*b-n<<endl;
    return 0;
}

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

 int main(){
  int x , cp;
  int y , Count = 0;
  scanf( "%d" , &x );
  cp = x;

     if( x <= 9 ){
      printf( "1\n" );
      return 0;
    }

     if( x == 201 ){
      cout << 99 << endl;
      return 0;
    }

     while( x ){
      y = x % 10;
      x /= 10;
      Count++;
    }

  int Ans = 0;

     if( y == 9 )
      Ans = ( 1LL * pow( 10 , Count ) ) - cp;
     else
      Ans = ( 1LL * ( y + 1 ) * pow( 10 , Count - 1 ) ) - cp;

  printf( "%d\n" , Ans );
  return 0;
}

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

template <class T1> void deb(T1 e)
{
    cout << e << endl;
}
template <class T1,class T2> void deb(T1 e1,T2 e2)
{
    cout << e1 << " "<< e2 << endl;
}
template <class T1,class T2,class T3> void deb(T1 e1,T2 e2,T3 e3)
{
    cout << e1 << " " << e2 << " " << e3 << endl;
}

#define oo          (1<<30)
#define SZ(a)       (int)a.size()
#define LL          long long int
#define ULL         unsigned long long
#define ISS         istringstream
#define OSS         ostringstream
#define VS          vector <string>
#define VI          vector <int>
#define VD          vector <double>
#define VLL         vector <long long>
#define SII         set<int>::iterator
#define SI          set<int>
#define mem(a,b)    memset(a,b,sizeof(a))
#define fs          first
#define sc          second
#define pii         pair < int , int >

#define EQ(a,b)     (fabs(a-b)<ERR)
#define all(a,b,c)  for(int I=0;I<b;I++)    a[I] = c
#define CROSS(a,b,c,d) ((b.x-a.x)*(d.y-c.y)-(d.x-c.x)*(b.y-a.y))
#define sqr(a)      ((a)*(a))
#define FORE(i,a)   for(typeof((a).begin())i=(a).begin();i!=(a).end();i++)
#define BE(a)       a.begin(),a.end()
#define RBE(a)      a.rbegin(),a.rend()
#define rev(a)      reverse(BE(a));
#define sorta(a)    sort(BE(a))
#define pb          push_back
#define popb        pop_back
#define round(i,a)  i = ( a < 0 ) ? a - 0.5 : a + 0.5;

#define makeint(n,s)  istringstream(s)>>n
#define string_to_int(str) atoll(str.c_str());

#define LCM(A,B)    ((__gcd(A,B))/A)*B
#define GCD(A,B)     __gcd(A,B)

#define YES     deb("YES")
#define Yes     deb("Yes")
#define yes     deb("yes")
#define NO      deb("NO")
#define No      deb("No");
#define no      deb("no");

#define read()      freopen("test.txt","r",stdin)
#define write()     freopen("WA.txt", "w", stdout);
#define Faster      {ios_base::sync_with_stdio(false); cin.tie(0);}

#define PI          3.141592653589793
#define pi          2*acos(0)
#define gama        0.57721566490
#define ERR         1e-5
#define PRE         1e-8
#define MAX         1000009

int dx[] = {-1, -1, -1,  0, 0,  1, 1, 1};
int dy[] = {-1,  0,  1, -1, 1, -1, 0, 1};

bool isvowel(char ch)
{
    ch = tolower(ch);
    return ch == 'a' or ch == 'e' or ch == 'i' or ch == 'o' or ch == 'u';
}

main()
{
    string str, str2;
    cin >> str;

    str2 += str[0]+1;
    LL Count = 0;
    for(int i = 1; i < str.length(); i++)
    {
        if(str[i] != '0')
            Count++;
        str2 += '0';
    }
    stringstream ss(str);
    LL x, y;
    ss >> x;
    stringstream ss2(str2);
    ss2 >> y;

    printf("%lld\n", y-x);

    return 0;
}

#include<iostream>
#include<cstdio>
#include<cstring>
#include<string>
#include<algorithm>
#include<cmath>

using namespace std;
const int maxn=1e3;
int StrtoInt(string num)
{
	int l=num.length();
	int sum=0;
	for(int i=0;i<l;i++)
	{
		sum+=(num[i]-'0')*pow(10,l-i-1);
	}
	return sum;
}
int main()
{
	string str;
	cin>>str;
	int l=str.length();
	if(l==1)
	{
		cout<<"1\n";
		return 0;
	 }
	else
	{
		int a=StrtoInt(str);
		int num=str[0]-'0'+1;
		int b=num*pow(10,l-1);
//		cout<<a<<" "<<b<<endl;
		int ans=b-a;
		cout<<ans<<endl;
		return 0;
	}
	return 0;
}

// problem
//  Created by 聂小楠 on 2017/5/18.
//  All rights reserved.
//
#include<bits/stdc++.h>
#define ll long long
#define MAX_N 10005
#define Mem(a,b) memset(a,b,sizeof(a))
#define FREI freopen("in.txt","r",stdin);
#define FREO freopen("out.txt","w",stdout);
using namespace std;

const ll mod =1e9+7;
ll q_pow(int a,int n)
{
    ll res=1;
    while(n>0)
    {
        if(n&1) res*=a;
        a=a*a;
        n>>=1;
    }
    return res;
}
int main()
{
    ll num;
    int fi,se,ret;
    fi=se=0;
    bool flag=0;
    cin>>num;
    while(num){
        if(!flag)fi++;
        if(num%10&&flag==0)flag=1,ret=num%10;
        se++;
        num/=10;
    }
    if(se==fi)
        cout<<q_pow(10,se-1)<<endl;
    else
        cout<<q_pow(10,se-1)-ret*q_pow(10,fi-1)<<endl;
    return 0;

}

#include <iostream>

using namespace std;

int main()
{
	int n;
	cin >> n;
	int n1 = n,n2;
	int i=0, p=0;
	while (n1 / 10)
	{
		int tmp = n1 % 10;
		i++;
		n1 /= 10;
		if (tmp == 0)
		{
			p = i;
		}
	}
	if (!i)
	{
		printf("1\n");
	}
	else
	{
		n1 = 1;
		for (int j = 0; j < p; j++)
		{
			n1 *= 10;
		}
		n2 = n/n1 + 1;
		printf("%d\n", n2*n1 - n);
	}
	return 0;
}

#include<iostream>
#include <stdio.h>
#include <string.h>
#include<stdlib.h>
#include <map>
#include <set>
#include <math.h>
#include <queue>
#include <algorithm>
#include<vector>
using namespace std;
char s1[1050000];
int k1[10];
int fun(int x){
	int t1=0;
	for(int i=9;i>=0;i--){
	int t2=pow(10,i);
		if(x>=t2){
		if(x%t2==0)return 1;
		else return 0;
	}
	}
}
int main(){
    //freopen("in.txt","r",stdin);
    int  i,j,k,l1,f1,f2,f3,f4,f5,t4,t1,m;
   	int T;
   	int r1,l2,r2;
   	int t3,n;
   	cin >> n;
   	t3=n;
	   n++;
	   while(1){
   		if(fun(n)){
   			cout << n-t3 << endl;break;
		}
		n++;
	}
}

#include<bits/stdc++.h>
using namespace std;
//bool visit[100]={0};
int main(){
	ios_base::sync_with_stdio(0);
    long long n,x;cin>>x;n=x;
    int c=0;
    while(n/10>=1)
    {
        n/=10;
        c++;
    }
    long long val;
    if(c==2||c==4||c==8||c==16)
    {
        val=pow(10,c);val++;
    }
    else
    {
        val=pow(10,c);
    }
    n++;n*=val;
    cout<<n-x;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
#define ll long long
int main()
{
    string s;
    cin>>s;
    ll x = s.size();
    ll n = stoi(s);
    ll i,m=0;

    for(i=0;i<s.size();i++)
    {
        if(i==0){
                if(s[i]=='9'){
                        if(i==0){
                            cout<<1;
                        }
                       for(i=1;i<s.size();i++)
                       {
                           cout<<0;
                       }
                       return 0;
                }
            int k = s[i]-'0';
        k++;
        s[i] = k+'0';
        }
        else{
            s[i] = '0';
        }
    }
    //cout<<s<<endl;
     m = stoi(s);
    cout<<m-n<<endl;

}

// Example program
#include <iostream>
#include <string>
using namespace std;

int main()
{
    long long x;
    cin >> x;
    if (x < 10){
    cout << "1";
    return 0;}

    int t(0), left(0);
    long long xx, ten(1);
    xx = x;
    while (x > 10)
    {
        t++;
        left += x % 10 * ten;
        ten *= 10;
        x /= 10;
    }
    if (left == 0) cout << ten;
    else cout << ten-left;

}

// #pragma comment(linker, "/STACK:1024000000,1024000000")
#include <stdio.h>
#include <iostream>
#include <cstdlib>
#include <cmath>
#include <cctype>
#include <string>
#include <cstring>
#include <algorithm>
#include <stack>
#include <queue>
#include <set>
#include <map>
#include <ctime>
#include <vector>
#include <fstream>
#include <list>
#include <iomanip>
#include <numeric>
using namespace std;
typedef long long ll;
typedef unsigned long long ull;
#define ms(s) memset(s, 0, sizeof(s))
const int inf = 0x3f3f3f3f;
#define LOCAL
const int maxn = 1e5 + 7;

int main(int argc, char * argv[])
{
    long long n;
    while (cin >> n){
        long long t = n;
        long long s = 1;
        while (n > 10){
            n /= 10;
            s *= 10;
        }
    //    cout << s << endl;
        long long sum = ((t) / s + 1) * s;
        cout << sum - t << endl;
        //cout << sum - t << endl;
    }
    return 0;
}

#include <iostream>
#include <math.h>
using namespace std;

int left_digit(int n) {
    if (n < 10) return n;
    return left_digit(n/10);
}

int number_of_digits(int n) {
    if (n < 10) return 1;
    return 1 + number_of_digits(n/10);
}

int main() {
    int current_year;
    cin >> current_year;
    int next_lucky_year = (left_digit(current_year) + 1) * pow(10, number_of_digits(current_year)-1);
    cout << next_lucky_year - current_year << endl;
}

#include<iostream>
#include<cmath>
using namespace std;
long long n,k,ans;
int main()
{
    cin>>n;
    long long t=n;
    while(t)
    {
        k++;
        t/=10;
    }
    if(n/pow(10,k-1)==9)
        cout<<pow(10,k)-n<<endl;
    else
        cout<<(pow(10,k-1)+n)/pow(10,k-1)*pow(10,k-1)-n<<endl;
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
int main()
{
	long long n,k;
	cin>>n;
	long long l=0,c,p=n;
	while(p!=0)
	{l++;
		c=p%10;
		p=p/10;
	}
	k=(c+1)*pow(10,l-1);
	cout<<k-n;
return 0;
}

#include<iostream>
#include<cmath>
using namespace std;

int n,f,l,ans;

main(){

	cin>>n;

	if(n<10){

		cout<<n+1<<endl;

		return 0;

	}

	f=n;

	while(f>9){

		f/=10;

		l++;

	}

	f++;

	f=f*pow(10,l);

	ans=f-n;

	cout<<ans<<endl;

}

//
//  main.cpp
//  Educational Codeforces Round 21 - A. Lucky Year
//
//  Created by S M HEMEL on 5/15/17.
//  Copyright © 2017 Eastern University. All rights reserved.
//

#include <iostream>
#include <string>
using namespace std;
int main()
{
    long int n;

    cin >> n;
    if(n<10)
        return 0 * puts("1");
    else{
        string s = to_string(n);
        int len = (int)s.length();
        cout << (s[0]-'0')+1;
        for(int i=1; i<len; i++)
            cout << "0";
        cout << endl;
    }
    return 0;
}

#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
#define speed ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
int main()
{
    speed
    ll n;
    cin>>n;
    string s;
    s=to_string(n);
    if(n<9)
        cout<<n+1;
    else
        cout<<(s[0]-'0'+1)*pow(10,s.size()-1)-n;

    return 0;

}

#include <iostream>
#include <math.h>
using namespace std;

typedef long long LL;

LL left_digit(LL n) {
    if (n < 10) return n;
    return left_digit(n/10);
}

LL number_of_digits(LL n) {
    if (n < 10) return 1;
    return 1 + number_of_digits(n/10);
}

int main() {
    LL current_year;
    cin >> current_year;
    LL next_lucky_year = (left_digit(current_year) + 1) * pow(10, number_of_digits(current_year)-1);
    cout << next_lucky_year - current_year << endl;
}

#include<cstdio>
#include<cmath>
#include<iostream>
#include<algorithm>
using namespace std;
int main()
{
	int n,cnt,i,tmp;
	while(cin>>n) {
		cnt = 0;
		tmp = n;
		if(n < 10)
		{
			cout<<"1"<<endl;
			continue;
		}
		else {
			for(i = 10; n/i > 0; n/=10) {
				++cnt;
			}
			if(n != 0 && tmp % (int)pow(10,cnt) != 0)
				cout<< (n+1)*pow(10,cnt) - tmp <<endl;
			else cout<<"0"<<endl;
		}
	}
	return 0;
}

#include <iostream>
#include <math.h>
using namespace std;
int main(){
	int A[1];
 double anho;
	cin>> anho;
	double b=0;
	int a=anho;
	if (anho>=10){
	while (a>=10){
			a=a/10;
			b++;
 }
  A[0]=((a+1)*pow(10,b)-anho);
 cout<<A[0]+1;
} else {cout<< 1;}
return 0;
}

#include <iostream>
#include <fstream>
#include <algorithm>
#include <string>
#include <vector>
using namespace std;

unsigned long long int year, digit = 0, temp, i;

int main()
{

	cin >> year;

	if (year > 1000000)
	{
		temp = year;
		for (int j = 0; temp != 0; ++j)
		{
			temp /= 10;
			++digit;
		}

		--digit;

		year = pow(10, digit);

		cout << year << endl;

	}

	else
	{
		for (i = year + 1; digit != 1; ++i)
		{
			temp = i;
			digit = 0;

			while (temp != 0)
			{
				if (temp % 10 != 0)
					++digit;

				if (digit > 1)
					break;

				temp /= 10;
			}

		}

		cout << i - year - 1 << endl;
	}

	return 0;
}

#include <bits/stdc++.h>
// vector string set map first second continue break return upper_bound lower_bound length void sort
#define FOR(i,j,n) for(int i=(j);i<=((int)n);++i)
#define N 1000005
#define INF 0x3f3f3f3f
#define MOD 1000000007
#define endl "\n"
#define mem(a,val) memset(a,val,sizeof(a))
#define all(c) (c).begin(),(c).end()
#define tr(container, it) for(__typeof(container.begin()) it = container.begin(); it != container.end(); it++)
#define present(container, element) (container.find(element) != container.end())
#define cpresent(c,x) (find(all(c),x) != (c).end())
#define pb push_back
#define debug(x) cout << ">>" << #x << " is " << x << "<<" << endl
typedef long long int ll;
#define int long long int
typedef std::map< int,int> mii;
typedef std::vector< int > vi;
typedef std::vector< vi > vvi;
typedef std::pair< int,int > ii;
using namespace std;
vector <int>g[N];

signed main()
{
    ios_base::sync_with_stdio(false);
    cin.tie(NULL);
#ifndef ONLINE_JUDGE
    freopen("C:\\Users\\hp\\Documents\\input.txt", "r", stdin);
    freopen("C:\\Users\\hp\\Documents\\output.txt", "w", stdout);
#endif
int n;
cin>>n;
int k=n;
int m=0;
int c=0;
int s=0;
int f=0;
while(k>0)
{
	int r=k%10;
	if (r!=0)
	{
		f=r;
		m=c;
	}
	k/=10;
	s+=r;
	c++;
}
s-=f;
int z=n+pow(10,m);
cout<<z-n-s<<endl;

}

// #Hala BBCF