#include <bits/stdc++.h>
using namespace std;
template <typename T>
inline T read() {
  register T sum = 0;
  register char cc = getchar();
  int sym = 1;
  while (cc != '-' && (cc > '9' || cc < '0')) cc = getchar();
  if (cc == '-') sym = -1, cc = getchar();
  sum = sum * 10 + cc - '0';
  cc = getchar();
  while (cc >= '0' && cc <= '9') sum = sum * 10 + cc - '0', cc = getchar();
  return sym * sum;
}
template <typename T>
inline T read(T &a) {
  a = read<T>();
  return a;
}
template <typename T, typename... Others>
inline void read(T &a, Others &...b) {
  a = read(a);
  read(b...);
}
struct Line {
  int l, r, p;
  bool operator<(const Line &o) const { return p < o.p; }
} l[110];
int n, m, f[110][110 * 3], g[110 * 3];
vector<int> vec;
int main() {
  read(n);
  vec.push_back(-1e9);
  for (int i = 1; i <= n; i++) {
    int a, len;
    read(a, len);
    l[i] = {a - len, a + len, a};
    vec.push_back(l[i].l);
    vec.push_back(l[i].r);
    vec.push_back(l[i].p);
  }
  sort(vec.begin(), vec.end());
  vec.erase(unique(vec.begin(), vec.end()), vec.end());
  m = vec.size() - 1;
  for (int i = 1; i <= n; i++) {
    l[i].l = lower_bound(vec.begin(), vec.end(), l[i].l) - vec.begin();
    l[i].r = lower_bound(vec.begin(), vec.end(), l[i].r) - vec.begin();
    l[i].p = lower_bound(vec.begin(), vec.end(), l[i].p) - vec.begin();
  }
  sort(l + 1, l + 1 + n);
  for (int i = 1; i <= n; i++) {
    memcpy(f[i], f[i - 1], sizeof(f[i]));
    int L = l[i].l, R = l[i].r, p = l[i].p;
    memset(g, 0, sizeof(g));
    int nr = p;
    g[nr] = f[i - 1][L] + vec[nr] - vec[L];
    for (int j = i - 1; j >= 1; j--) {
      nr = max(nr, l[j].r);
      g[nr] = max(g[nr], f[j - 1][L] + vec[nr] - vec[L]);
    }
    for (int j = m; j >= L; j--) {
      f[i][j] = max(f[i][j], g[j]);
      g[j - 1] = max(g[j - 1], g[j] - (vec[j] - vec[j - 1]));
    }
    for (int j = p; j <= R; j++)
      f[i][j] = max(f[i][j], f[i - 1][p] + vec[j] - vec[p]);
    for (int j = 1; j <= m; j++) f[i][j] = max(f[i][j], f[i][j - 1]);
  }
  printf("%d\n", f[n][m]);
  return 0;
}
