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