#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  int sum = 0;
  cin >> t;
  vector<int> v;
  while (t--) {
    int a, b;
    cin >> a >> b;
    sum = (sum - a);
    sum = sum + b;
    v.push_back(sum);
  }
  sort(v.begin(), v.end());
  int s = v.size();
  cout << v[s - 1] << endl;
}
