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