#include <bits/stdc++.h>
namespace Main {
namespace Sourse {
enum { N = 100, L = (const long unsigned int)1e8 };
using std::min;
using std::sort;
static inline const void amax(long unsigned int& a, const long unsigned int b) {
  if (a < b) a = b;
}
}  // namespace Sourse
using namespace Sourse;
struct spotlight {
  long signed int a;
  long unsigned int l;
  spotlight() : a(-L), l(0) {}
  inline const void input() { scanf("%ld%lu", &a, &l); }
  friend inline const bool operator<(const spotlight& a, const spotlight& b) {
    return a.a < b.a;
  }
};
static short unsigned int n;
static spotlight s[N + 1];
static long unsigned int f[N + 1][N + 1][2];
static long unsigned int ans(0);
static inline const void begin() {
  scanf("%hu", &n);
  for (short unsigned int i(1); i <= n; ++i) s[i].input();
  sort(s + 1, s + 1 + n);
}
static inline const void end() { printf("%lu\n", ans); }
static inline const void main() {
  begin();
  for (short unsigned int i(0); i <= n; ++i) {
    for (short unsigned int j(0); j <= i; ++j) {
      for (short unsigned int k(0); k < 2; ++k) {
        amax(ans, f[i][j][k]);
        long signed int r(s[j].a + s[j].l * k), max_r(r);
        short unsigned int _j(j), _k(k);
        for (short unsigned int l(i + 1); l <= n; ++l) {
          for (short unsigned int m(0); m < 2; ++m) {
            const long signed int _r(s[l].a + s[l].l * m);
            if (_r >= max_r) max_r = _r, _j = l, _k = m;
            if (_r < r) continue;
            amax(f[l][_j][_k],
                 f[i][j][k] + min((const long unsigned int)(_r - r), s[l].l) +
                     (max_r - _r));
          }
        }
      }
    }
  }
  end();
}
}  // namespace Main
signed int main() {
  Main::main();
  return 0;
}
