#include <bits/stdc++.h>
using namespace std;
int main() {
  int stops;
  cin >> stops;
  int max = 0, cur = 0;
  for (int i = 0; i < stops; i++) {
    int out, in;
    cin >> out >> in;
    cur = cur - out + in;
    if (cur > max) max = cur;
  }
  cout << max;
  return 0;
}
