#include <bits/stdc++.h>
int main(int argc, const char* argv[]) {
  int n, a, b, res = 0, res_max = 0;
  std::cin >> n;
  for (int i = 0; i < n; ++i) {
    std::cin >> a >> b;
    res += b - a;
    res_max = std::max(res, res_max);
  }
  std::cout << res_max;
  return 0;
}
