#include <bits/stdc++.h>
struct S {
  int l, r, p;
} s[205];
int f[205][205], n, a, b, m, r;
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &a, &b), s[++m] = {a - b, a, i}, s[++m] = {a, a + b, i};
  std::sort(s + 1, s + m + 1, [&](S a, S b) { return a.r < b.r; });
  for (int i = 1; i <= m; i++) f[0][i] = s[i].r - s[i].l;
  for (int i = 0; i <= m; i++)
    for (int j = i + 1; j <= m; j++) {
      for (int k = j + 1; k <= m; k++)
        if ((!i || s[k].l > s[i].r) && s[k].p != s[j].p)
          f[i][j] + s[k].r - std::max(s[k].l, s[j].r) > f[j][k]
              ? f[j][k] = f[i][j] + s[k].r - std::max(s[k].l, s[j].r)
              : 0;
      f[i][j] > r ? r = f[i][j] : 0;
    }
  printf("%d", r);
}
