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