#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, sum = 0;
  cin >> n;
  int a[n][2], maxi = -100;
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> a[i][j];
    }
  }
  for (int i = 0; i < n; i++) {
    for (int j = 0; j <= 0; j++) {
      sum = sum - a[i][j];
      sum = sum + a[i][j + 1];
      maxi = max(maxi, sum);
    }
  }
  cout << maxi;
}
