#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cnt = 0, ant = 0;
  vector<int> v;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    cnt += b;
    ant += a;
    int ans = cnt - ant;
    v.push_back(ans);
  }
  int len = v.size();
  int Max = v[0];
  for (int i = 1; i < len; i++) {
    if (v[i] > Max) {
      Max = v[i];
    }
  }
  cout << Max << endl;
}
