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