#include <bits/stdc++.h>
using namespace std;
int main() {
  int t, a, b, sum = 0, max = 0;
  cin >> t;
  while (t--) {
    cin >> a;
    cin >> b;
    sum = sum - a + b;
    if (max < sum) max = sum;
  }
  cout << max << endl;
  return 0;
}
