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