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