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

int main()
{
    long long N, a[100000], b[100000];
    cin >> N;
    long long sum = 0;
    for (int i = 0; i < N; i++)
    {
        cin >> a[i] >> b[i];
        sum += b[i] * (b[i] + 1) / 2 - a[i] * (a[i] -1) / 2;
    }

    cout << sum;

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

int main(){
  int n;
  cin >> n;
  map<int, string> A;
  priority_queue<int> B;
  int t;
  string s;
  for(int i=0;i<n;i++){
    cin >> s >> t;
    A[t] = s;
    B.push(t);
  }
  B.pop();
  cout << A[B.top()] << endl;
}