#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, x, y, i, j;
  int l = 0, t = 0, m = 0, max = 0;
  cin >> n;
  cin >> i >> j;
  l = j;
  while (t < n) {
    t++;
    cin >> x >> y;
    m = j - x + y;
    if (m > max) {
      max = m;
    }
    j = m;
  }
  if (max == 0 && l > 0 || l > max)
    cout << l;
  else
    cout << max;
  return 0;
}
