#include <bits/stdc++.h>
int main() {
  int i, j, k, n, m, t, x, y, l, s, max;
  while (~scanf("%d", &t)) {
    s = 0;
    max = 0;
    scanf("%d %d", &x, &y);
    s = y;
    max = s;
    for (i = 0; i < t - 1; i++) {
      scanf("%d %d", &x, &y);
      s = s - x + y;
      if (s > max) {
        max = s;
      }
    }
    printf("%d\n", max);
  }
}
