#include<bits/stdc++.h>
using namespace std;
const int N=101000;
#define x first
#define y second
struct node{
	int val;
	string ch;
}arr[13456];
bool cmp(node a,node b)
{
	return a.val>b.val;
}
long long dp[105][105];
int main()
{
	int n;
	cin>>n;
	for(int i=1;i<=n;i++)
	cin>>arr[i].ch>>arr[i].val;
	sort(arr+1,arr+1+n,cmp);
	cout<<arr[2].ch<<endl;
}
#include <bits/stdc++.h>
using namespace std;
#define rep(i, n) for (int i = 0; i < (int)(n); i++)

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