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