#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s, d, cnt = 0, ans = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s >> d;
    cnt -= s;
    cnt += d;
    if (cnt >= ans) ans = cnt;
  }
  cout << ans;
}
