#include <bits/stdc++.h>
using namespace std;
string tout[4] = {"NO", "YES", "No", "Yes"};
using vi = vector<int>;
using vll = vector<long long>;
using vld = vector<long double>;
using vch = vector<char>;
using mi = map<int, int>;
using mll = map<long long, long long>;
using msll = map<string, long long>;
using mchll = map<char, long long>;
using sll = set<long long>;
using si = set<int>;
using pll = pair<long long, long long>;
const long long INF = 1e9 + 5;
const long long MOD = 1e5;
const long long ASO = 1e18 + 5;
const long long ANI = 1e6 + 5;
const long long inf = -1e9;
const long long mod = -1e5;
const long long aso = -1e18;
const long long ISM = 1e4 + 5;
long long n, a = 1;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  cin >> n;
  while (a * 10 <= n) {
    a *= 10;
  }
  for (int i = 1; i <= 1000; ++i) {
    if (a * i > n) {
      cout << abs(n - a * i);
      return 0;
    }
  }
  return 0;
}
