#include <bits/stdc++.h>
using namespace std;
int main() {
  int N(0), aSum(0), bSum(0), cap(0), last(0), out(0);
  cin >> N;
  for (int i = 0; i < N; i++) {
    int a(0), b(0);
    cin >> a >> b;
    aSum += a;
    bSum += b;
    cap = bSum - aSum;
    if (cap >= out) out = cap;
  }
  cout << out << endl;
  return 0;
}
