#include <bits/stdc++.h>
using namespace std;
void init_code() {
  freopen("input.txt", "r", stdin);
  freopen("output.txt", "w", stdout);
}
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  int n;
  cin >> n;
  int arr[n][2];
  for (int i = 0; i < n; i++) {
    for (int j = 0; j < 2; j++) {
      cin >> arr[i][j];
    }
  }
  int entry = arr[0][1];
  int best = entry;
  for (int k = 1; k < n; k++) {
    entry = entry - arr[k][0] + arr[k][1];
    best = max(best, entry);
  }
  cout << best;
}
