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