#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read(register T& t) {
  register T f = 1;
  register char ch = getchar();
  t = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -f;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') t = t * 10 + ch - '0', ch = getchar();
  t *= f;
  return t;
}
template <typename T, typename... Args>
inline void read(T& t, Args&... args) {
  read(t);
  read(args...);
}
const long long p = 998244353;
inline long long power(register long long x, register long long k = p - 2) {
  register long long re = 1;
  for (; k; k >>= 1, x = x * x % p)
    if (k & 1) re = re * x % p;
  return re;
}
int n;
pair<int, int> a[105];
int f[105][105][2];
int main() {
  read(n);
  for (int i = 1; i <= n; i++) read(a[i].first, a[i].second);
  sort(a + 1, a + n + 1);
  a[0].first = -1e8;
  int ans = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++)
      for (int p = 0; p <= 1; p++) {
        int x = a[j].first + p * a[j].second;
        int v = 0, y = -1e9, qwq = 0;
        for (int k = i + 1; k <= n; k++)
          for (int q = 0; q <= 1; q++) {
            int t = a[k].first + a[k].second * q;
            if (t > y) y = t, v = k, qwq = q;
            f[k][v][qwq] =
                max(f[k][v][qwq], f[i][j][p] + min(a[k].second, t - x) + y - t);
          }
      }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= n; j++)
      for (int p = 0; p <= 1; p++) ans = max(ans, f[i][j][p]);
  printf("%lld\n", ans);
  return 0;
}
