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