#include <bits/stdc++.h>
using namespace std;
int main() {
  int t;
  cin >> t;
  int temp = 0, max = 0;
  for (int i = 0; i < t; i++) {
    int x, y;
    cin >> x >> y;
    temp = temp - x + y;
    if (temp > max) max = temp;
  }
  cout << max;
}
