#include <bits/stdc++.h>
using namespace std;
int main(int argc, char *argv[]) {
  int n;
  while (scanf("%d", &n) != EOF) {
    int ans = 0;
    int t = 0;
    for (int i = 1; i <= n; i++) {
      int a, b;
      scanf("%d%d", &a, &b);
      t -= a;
      t += b;
      if (t > ans) ans = t;
    }
    printf("%d\n", ans);
  }
  return 0;
}
