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