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