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