#include <bits/stdc++.h>
inline int getint() {
  register char ch;
  while (!isdigit(ch = getchar()))
    ;
  register int x = ch ^ '0';
  while (isdigit(ch = getchar())) x = (((x << 2) + x) << 1) + (ch ^ '0');
  return x;
}
const int N = 301;
std::vector<int> tmp;
struct Node {
  int p, l, r;
  bool operator<(const Node &rhs) const { return p < rhs.p; }
};
Node p[N];
long long f[2][N * 3], id[N];
int main() {
  const int n = getint();
  for (register int i = 1; i <= n; i++) {
    p[i].p = getint();
    p[i].l = p[i].r = getint();
    tmp.push_back(p[i].p - p[i].l);
    tmp.push_back(p[i].p);
    tmp.push_back(p[i].p + p[i].r);
  }
  tmp.push_back(INT_MIN);
  std::sort(&p[1], &p[n] + 1);
  std::sort(tmp.begin(), tmp.end());
  tmp.resize(std::unique(tmp.begin(), tmp.end()) - tmp.begin());
  const int m = tmp.size() - 1;
  for (register int i = 1; i <= n; i++) {
    p[i].l =
        std::lower_bound(tmp.begin(), tmp.end(), p[i].p - p[i].l) - tmp.begin();
    p[i].r =
        std::lower_bound(tmp.begin(), tmp.end(), p[i].p + p[i].r) - tmp.begin();
    p[i].p = std::lower_bound(tmp.begin(), tmp.end(), p[i].p) - tmp.begin();
    id[p[i].p] = i;
  }
  for (register int i = 1; i <= n; i++) {
    const bool cur = i & 1;
    for (register int j = 1; j <= m; j++) {
      f[cur][j] = f[!cur][j];
    }
    for (register int j = p[i].l + 1; j <= p[i].p; j++) {
      f[cur][j] = std::max(f[cur][j], f[cur][j - 1] + tmp[j] - tmp[j - 1]);
    }
    long long max = f[!cur][p[i].p];
    for (register int j = p[i].p + 1; j <= p[i].r; j++) {
      f[cur][j] = std::max(f[cur][j], max + tmp[j] - tmp[p[i].p]);
      if (id[j] != 0 && p[id[j]].l < p[i].p) {
        max =
            std::max(max, tmp[p[i].p] - tmp[p[id[j]].l] + f[!cur][p[id[j]].l]);
      }
    }
    for (register int j = 1; j <= m; j++) {
      f[cur][j] = std::max(f[cur][j], f[cur][j - 1]);
    }
  }
  printf("%lld\n", f[n & 1][m]);
  return 0;
}
