#include <bits/stdc++.h>
using namespace std;
int main() {
  int n = 0, capacity = 0, r = 0, e = 0, l = 0;
  vector<int> p_enter;
  vector<int> p_leave;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> l;
    p_leave.push_back(l);
    cin >> e;
    p_enter.push_back(e);
  }
  r = p_enter[0];
  capacity = p_enter[0];
  for (int i = 1; i < n - 1; i++) {
    r = p_enter[i] - p_leave[i] + r;
    if (capacity < r) {
      capacity = r;
    }
  }
  cout << capacity;
  return 0;
}
