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