#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int ans = 0, x = 0;
  while (n--) {
    int a, b;
    cin >> a >> b;
    x += (b - a);
    ans = max(ans, x);
  }
  cout << ans << '\n';
  return 0;
}
