#include <bits/stdc++.h>
using namespace std;
int main() {
  int i = 0, n;
  cin >> n;
  int a[n], b[n];
  int max = 0;
  int pas = 0;
  for (i = 0; i < n; i++) {
    cin >> a[i] >> b[i];
    pas += b[i] - a[i];
    if (max < pas) {
      max = pas;
    }
  }
  cout << max;
  return 0;
}
