#include <bits/stdc++.h>
using namespace std;
const long long N = 100 + 5;
long long n;
struct P {
  long long x, y;
};
inline bool operator<(const P &a, const P &b) {
  if (a.x != b.x)
    return a.x < b.x;
  else
    return a.y < b.y;
}
P pn[N];
long long mxat[N][N];
inline long long segq(long long l, long long r, long long L, long long R) {
  l = max(l, L), r = min(r, R);
  return max(0LL, r - l);
}
map<pair<pair<long long, long long>, pair<long long, long long> >, long long>
    mp;
long long dp(long long l, long long r, long long L, long long R) {
  if (l > r || L >= R) return 0;
  pair<pair<long long, long long>, pair<long long, long long> > pp =
      make_pair(make_pair(l, r), make_pair(L, R));
  if (mp.count(pp)) return mp[pp];
  long long mid = mxat[l][r], a = pn[mid].x, len = pn[mid].y;
  long long ans1 = dp(l, mid - 1, L, min(R, a - len)) +
                   dp(mid + 1, r, max(L, a), R) + segq(a - len, a, L, R);
  long long ans2 = dp(l, mid - 1, L, min(R, a)) +
                   dp(mid + 1, r, max(L, a + len), R) + segq(a, a + len, L, R);
  for (long long i = mid + 1; i <= r; ++i)
    if (pn[i].x - pn[i].y <= a) {
      long long v = dp(l, mid - 1, L, min(R, pn[i].x - pn[i].y));
      v += dp(i + 1, r, max(L, a + len), R);
      v += segq(L, R, pn[i].x - pn[i].y, a + len);
      ans1 = max(ans1, v);
    }
  for (long long i = l; i <= mid - 1; ++i)
    if (pn[i].x + pn[i].y >= a) {
      long long v = dp(l, i - 1, L, min(R, a - len));
      v += dp(mid + 1, r, max(L, pn[i].x + pn[i].y), R);
      v += segq(L, R, a - len, pn[i].x + pn[i].y);
      ans2 = max(ans2, v);
    }
  return mp[pp] = max(ans1, ans2);
}
signed main() {
  scanf("%I64d", &n);
  for (long long i = 1; i <= n; ++i) scanf("%I64d%I64d", &pn[i].x, &pn[i].y);
  sort(pn + 1, pn + n + 1);
  for (long long i = 1; i <= n; ++i) {
    mxat[i][i] = i;
    for (long long j = i + 1; j <= n; ++j) {
      mxat[i][j] = mxat[i][j - 1];
      if (pn[j].y > pn[mxat[i][j]].y) mxat[i][j] = j;
    }
  }
  printf("%I64d\n", dp(1, n, -1000000005, 2000000005));
  return 0;
}
