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

#ifdef LOCAL
#include "dump.hpp"
#else
#define dump(...)
#define dumpv(...)
#endif

#define rep(i, n) for (int i = 0; i < (n); i++)
#define mins(x, y) (x = min(x, y))
#define maxs(x, y) (x = max(x, y))
using ll = long long;
using vi = vector<int>;
using vl = vector<ll>;
using vvi = vector<vi>;
using vvl = vector<vl>;
using P = pair<int, int>;
const int MOD = 1e9 + 7;
const int INF = 1001001001;
const ll LINF = 1001002003004005006ll;

void solve() {
  ll n;
  cin >> n;
  ll p = (n + 1) * 2;
  ll x = sqrt(p);
  if (x * (x + 1) / 2 > n + 1) {
    x--;
  }
  dump(n+1, x, x*(x+1)/2);
  cout << n - x + 1 << endl;
  // cout << c << endl;
}

int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  cout << fixed << setprecision(15);
  // freopen("temp.1", "r", stdin);
  solve();
  return 0;
}
//#include <bits/stdc++.h>
#include<cstdio>
#include<cstring>
#include<algorithm>
#include<iostream>
#include<string>
#include<vector>
#include<stack>
#include<bitset>
#include<cstdlib>
#include<cmath>
#include<set>
#include<list>
#include<deque>
#include<map>
#include<unordered_map>
#include<queue>

#define INF 0x3f3f3f3f
#define ll long long
#define LL long long
#define ull unsigned long long
#define endl '\n'
#define ios ios::sync_with_stdio(false);
#define open freopen("in.in","w",stdout);
using namespace std;
const int maxn = 1e5 + 10;
const ll mod = 1e9 + 7;

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


