#include <bits/stdc++.h>
using namespace std;
int main() {
  int i, n, x = 0, exit, enter, ans = 0;
  cin >> n;
  for (i = 0; i < n; ++i) {
    cin >> exit >> enter;
    x -= exit;
    x += enter;
    ans = max(ans, x);
  }
  cout << ans;
  return 0;
}
