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