#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int maximum = 0, a, b, current = 0;
  while (n--) {
    cin >> a >> b;
    if (current >= a) {
      current = current - a;
    }
    current = current + b;
    if (maximum <= current) {
      maximum = current;
    }
    if (n == 1) {
      current = 0;
    }
  }
  cout << maximum << endl;
  return 0;
}
