#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int count = 0;
  int min = 0;
  for (int i = 0; i < t; i += 1) {
    int n, m;
    cin >> n >> m;
    count -= n;
    count += m;
    if (min < count) {
      min = count;
    }
  }
  cout << min << endl;
  return 0;
}
