#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b;
  int total = 0;
  int m = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a >> b;
    if (a < 0) break;
    total = total - a + b;
    if (m < total) m = total;
  }
  cout << m;
  return 0;
}
