#include <bits/stdc++.h>
using namespace std;
int main() {
  pair<int, int> a[1001];
  int b, c = 0, c1max = 0, d, arr[1001];
  cin >> b;
  for (int q = 0; q < b; q++) cin >> a[q].first >> a[q].second;
  for (int q = 0; q < b; q++) {
    c -= a[q].first;
    c += a[q].second;
    if (c > c1max) c1max = c;
  }
  cout << c1max;
}
