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