#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, min = 0, sum = 0;
  const int s = 1000;
  int a[s], b[s];
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> a[i];
    cin >> b[i];
    sum = sum - a[i] + b[i];
    if (sum > min) min = sum;
  }
  cout << min;
  return 0;
}
