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