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