#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, in, out, sum, maxn;
  while ((scanf("%d", &n)) != EOF) {
    sum = 0, maxn = 0;
    for (int i = 0; i < n; i++) {
      scanf("%d%d", &out, &in);
      sum = sum - out + in;
      if (maxn < sum) maxn = sum;
    }
    cout << maxn << endl;
  }
  return 0;
}
