#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int max = 0;
  int in = 0;
  while (t--) {
    int ai, bi;
    cin >> ai >> bi;
    in -= ai;
    in += bi;
    if (max < in) max = in;
  }
  cout << max;
  return 0;
}
