#include <bits/stdc++.h>
using namespace std;
long long f[110][110 * 3], ans, san[110 * 3];
int n, cnt;
struct info {
  int p, l, r;
} a[110];
template <typename T>
void chkmin(T &x, T y) {
  x = min(x, y);
}
template <typename T>
void chkmax(T &x, T y) {
  x = max(x, y);
}
template <typename T>
void read(T &x) {
  x = 0;
  int f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  x *= f;
}
bool cmpp(info a, info b) { return a.p < b.p; }
int main() {
  read(n);
  for (int i = 1; i <= n; ++i) {
    read(a[i].p), read(a[i].l);
    a[i].r = a[i].p + a[i].l;
    a[i].l = a[i].p - a[i].l;
  }
  for (int i = 1; i <= n; ++i) {
    san[(i - 1) * 3 + 1] = a[i].p;
    san[(i - 1) * 3 + 2] = a[i].l;
    san[(i - 1) * 3 + 3] = a[i].r;
  }
  sort(san + 1, san + 1 + 3 * n);
  cnt = unique(san + 1, san + 1 + 3 * n) - san - 1;
  for (int i = 1; i <= n; ++i)
    a[i].l = lower_bound(san + 1, san + 1 + cnt, a[i].l) - san,
    a[i].p = lower_bound(san + 1, san + 1 + cnt, a[i].p) - san,
    a[i].r = lower_bound(san + 1, san + 1 + cnt, a[i].r) - san;
  sort(a + 1, a + 1 + n, cmpp);
  for (int i = 1; i <= n; ++i) {
    for (int j = 1; j <= cnt; ++j) f[i][j] = f[i - 1][j];
    int l = a[i].l, r = a[i].p;
    chkmax(f[i][r], f[i - 1][l] + san[r] - san[l]);
    int maxn = r;
    for (int j = i - 1; j >= 0; --j) {
      chkmax(f[i][maxn], f[j][l] + san[maxn] - san[l]);
      chkmax(maxn, a[j].r);
    }
    l = a[i].p, r = a[i].r;
    chkmax(f[i][r], f[i - 1][l] + san[r] - san[l]);
    for (int j = cnt - 1; j >= 1; --j)
      chkmax(f[i][j], f[i][j + 1] - (san[j + 1] - san[j]));
    for (int j = 1; j <= cnt; ++j) chkmax(f[i][j], f[i][j - 1]);
  }
  for (int i = 1; i <= cnt; ++i) chkmax(ans, f[n][i]);
  printf("%I64d\n", ans);
  return 0;
}
