#include <bits/stdc++.h>
#pragma GCC optimize("O3")
using namespace std;
const int N = (int)1e6 + 100;
const int M = (int)1e4 + 4;
const int INF = (int)0x3f3f3f3f;
long long GCD(long long a, long long b) { return (b == 0) ? a : GCD(b, a % b); }
int n = 0, a = 0, b = 0, Capacity = 0, MX = INT_MIN;
int Solve() {
  std::ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (long long i = 0; i < n; ++i) {
    cin >> a >> b;
    Capacity += (b - a);
    MX = max(Capacity, MX);
  }
  cout << MX << endl;
  return 0;
}
int main() {
  Solve();
  return 0;
}
