#include <bits/stdc++.h>
using namespace std;
int main() {
  int a;
  cin >> a;
  int max = 0;
  int now = 0;
  for (int u = 0; u < a; u++) {
    int c, d;
    cin >> c >> d;
    now -= c;
    now += d;
    max = (max > now ? max : now);
  }
  cout << max;
  return 0;
}
