#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int i;
  int mx = 0;
  int sum = 0;
  int ext, ent;
  for (i = 0; i < n; i++) {
    cin >> ext >> ent;
    sum = sum - ext;
    sum += ent;
    if (sum > mx) {
      mx = sum;
    }
  }
  cout << mx;
  return 0;
}
