#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int a[n];
  int b[n];
  for (int i = 0; i < n; i++) cin >> a[i] >> b[i];
  int Max = 0;
  int now = 0;
  for (int i = 0; i < n; i++) {
    now -= a[i];
    now += b[i];
    if (now > Max) Max = now;
  }
  cout << Max;
}
