#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, personas = 0, max = 0;
  cin >> n;
  while (n--) {
    cin >> a >> b;
    personas = personas - a + b;
    if (personas > max) max = personas;
  }
  cout << max << endl;
  return 0;
}
