#include <bits/stdc++.h>
using namespace std;
int main() {
  int t = 0, m = 0, sum = 0;
  cin >> t;
  for (int i = 0; i < t; i++) {
    int x = 0, y = 0;
    cin >> x >> y;
    sum -= x;
    sum += y;
    m = max(m, sum);
  }
  cout << m;
  return 0;
}
