#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ans;
  int c;
  for (int i = 0; i < n; i++) {
    int x, y;
    cin >> x >> y;
    if (!i) {
      ans = y;
      c = y;
    } else {
      c = c - x + y;
      ans = max(ans, c);
    }
  }
  cout << ans;
}
