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