#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n;
  cin >> n;
  vector<int> a(n), b(n);
  for (int i = 0; i < n; ++i) cin >> a[i] >> b[i];
  int maxCap = b[0], curCap = b[0];
  for (int i = 1; i < n; ++i) {
    curCap = curCap - a[i] + b[i];
    maxCap = max(maxCap, curCap);
  }
  cout << maxCap << '\n';
  return 0;
}
