#include <bits/stdc++.h>
int main() {
  int a[2000], b[1000];
  int i, j, k, n, s, max, t;
  scanf("%d", &n);
  for (i = 0; i < 2 * n; i++) {
    scanf("%d", &a[i]);
  }
  b[0] = 0;
  k = 1;
  for (j = 0; j < 2 * n; j = j + 2) {
    b[k] = b[k - 1] + a[j + 1] - a[j];
    k++;
  }
  max = 0;
  for (j = 0; j < n; j++) {
    if (b[j] > max) {
      max = b[j];
    }
  }
  printf("%d", max);
  return 0;
}
