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