#include <bits/stdc++.h>
using namespace std;
const int N = 105;
const int INF = 0x3f3f3f3f;
template <typename T>
inline void read(T &AKNOI) {
  T x = 0, flag = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') flag = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  AKNOI = flag * x;
}
template <typename T>
inline void cmax(T &x, T y) {
  if (x < y) x = y;
}
int n, dp[N][N][2], ans;
struct Node {
  int p, l;
  bool operator<(const Node &rhs) const { return p < rhs.p; }
} a[N];
void init() {
  read(n);
  for (int i = 1; i <= n; ++i) {
    read(a[i].p);
    read(a[i].l);
  }
  a[0].p = -INF;
  sort(a + 1, a + n + 1);
}
void solve() {
  for (int i = 0; i <= n; ++i) {
    for (int j = 0; j <= i; ++j) {
      for (int s = 0; s < 2; ++s) {
        cmax(ans, dp[i][j][s]);
        int r1 = a[j].p + s * a[j].l, rbd = -INF, bk, bt;
        for (int k = i + 1; k <= n; ++k) {
          for (int t = 0; t < 2; ++t) {
            int r2 = a[k].p + t * a[k].l;
            if (r2 > rbd) {
              rbd = r2;
              bk = k;
              bt = t;
            }
            cmax(dp[k][bk][bt],
                 dp[i][j][s] + min(a[k].l, r2 - r1) + (rbd - r2));
          }
        }
      }
    }
  }
  printf("%d\n", ans);
}
int main() {
  init();
  solve();
  return 0;
}
