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