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