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