#include <bits/stdc++.h>
using namespace std;
int n;
int mayor;
int dentro;
void proceso() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    int a;
    int b;
    scanf("%d", &a);
    scanf("%d", &b);
    dentro -= a;
    dentro += b;
    mayor = max(mayor, dentro);
  }
  cout << mayor << endl;
}
int main() {
  proceso();
  return 0;
}
