#include <bits/stdc++.h>
int main() {
  int i, n, a, b;
  int now, max;
  scanf("%d", &n);
  now = 0;
  max = 0;
  for (i = 0; i < n; i++) {
    scanf("%d%d", &a, &b);
    now = now - a;
    now = now + b;
    if (now > max) max = now;
  }
  printf("%d", max);
  return 0;
}
