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