#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int a[1002];
  int b[1002];
  int c[1002];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
  }
  c[0] = b[0];
  c[1] = b[0] + b[1] - a[1];
  for (int i = 2; i <= n; i++) {
    c[i] = c[i - 1] - a[i] + b[i];
  }
  sort(c, c + n);
  reverse(c, c + n);
  cout << c[0] << endl;
  return 0;
}
