#include <bits/stdc++.h>
int main() {
  int n{};
  std::cin >> n;
  int a{}, b{};
  std::cin >> a >> b;
  int cap{b}, temp1{}, temp2{};
  for (int i = 1; i < n; i++) {
    int a1{}, b1{};
    std::cin >> a1 >> b1;
    if (i == 1) {
      temp1 = b - a1;
      temp2 = temp1 + b1;
    } else if (i == n - 1) {
      temp1 = temp2 - a1;
    } else {
      temp1 = temp2 - a1;
      temp2 = temp1 + b1;
    }
    cap = std::max(temp2, cap);
  }
  std::cout << cap;
  return 0;
}
