#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, a, b, maximum = -100000;
  cin >> n;
  int arr[n][2];
  int ans = 0;
  vector<int> s;
  for (int i = 0; i < n; i++) {
    cin >> arr[i][0] >> arr[i][1];
  }
  ans = arr[0][1];
  s.push_back(ans);
  for (int i = 1; i < n; i++) {
    ans -= arr[i][0];
    s.push_back(ans);
    ans += arr[i][1];
    s.push_back(ans);
  }
  for (int i = 0; i < s.size(); i++) {
    if (maximum < s[i]) maximum = s[i];
  }
  if (maximum < 0)
    cout << "0";
  else
    cout << maximum;
}
