#include <bits/stdc++.h>
using namespace std;
long long gcd(long long a, long long b) {
  long long m2 = max(a, b);
  long long m1 = min(a, b);
  if (m1 == 0)
    return m2;
  else
    return gcd(m2 % m1, m1);
}
long long fac(long long x) {
  if (x == 0 || x == 1)
    return 1;
  else
    return x * fac(x - 1);
}
bool check_prime(long long x) {
  if (x <= 1) return false;
  if (x <= 3) return true;
  if (x % 2 == 0 || x % 3 == 0)
    return false;
  else {
    for (int i = 5; i * i <= x; i += 6) {
      if (x % i == 0 || x % (i + 2) == 0) return false;
    }
  }
  return true;
}
long long lcm(long long a, long long b) { return a * b / gcd(a, b); }
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  int q = 1;
  while (q--) {
    long long n;
    cin >> n;
    long long a = 0;
    long long sum = 0, ans = 0;
    for (long long i = 0; i < n; i++) {
      long long a, b;
      cin >> a >> b;
      sum += b - a;
      ans = max(ans, sum);
    }
    cout << ans << endl;
  }
  return 0;
}
