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