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