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