#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int exit[n];
  int enter[n];
  for (int i = 0; i < n; i++) {
    cin >> exit[i];
    cin >> enter[i];
  }
  int maxCount = 0;
  int currentTotal = 0;
  for (int i = 0; i < n; i++) {
    currentTotal = currentTotal + enter[i] - exit[i];
    maxCount = max(maxCount, currentTotal);
  }
  cout << maxCount << endl;
  return 0;
}
