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