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