#include <bits/stdc++.h>
#pragma GCC optimize(2)
#pragma GCC optimize(3)
using namespace std;
inline int read() {
  int x = 0, neg = 1;
  char op = getchar();
  while (!isdigit(op)) {
    if (op == '-') neg = -1;
    op = getchar();
  }
  while (isdigit(op)) {
    x = 10 * x + op - '0';
    op = getchar();
  }
  return neg * x;
}
inline void print(int x) {
  if (x < 0) {
    putchar('-');
    x = -x;
  }
  if (x >= 10) print(x / 10);
  putchar(x % 10 + '0');
}
void ckmax(int &a, int b) {
  if (a < b) a = b;
}
const int N = 105;
const int inf = 1e9;
struct Point {
  int x, l;
  friend bool operator<(const Point &a, const Point &b) { return a.x < b.x; }
} p[N];
int dp[N][N][2], n;
int ans = 0;
int main() {
  scanf("%d", &n);
  for (register int i = 1; i <= n; i++) {
    p[i].x = read(), p[i].l = read();
  }
  sort(p + 1, p + n + 1);
  p[0].x = -inf;
  for (register int i = 0; i <= n; i++) {
    for (register int j = 0; j <= i; j++) {
      for (register int di = 0; di < 2; di++) {
        ans = max(ans, dp[i][j][di]);
        int pre = p[j].x + di * p[j].l;
        for (register int k = i + 1, Max = -inf, a, b; k <= n; k++) {
          for (register int dj = 0; dj < 2; dj++) {
            int nxt = p[k].x + dj * p[k].l;
            if (nxt > Max) {
              Max = nxt, a = k, b = dj;
            }
            ckmax(dp[k][a][b],
                  dp[i][j][di] + min(p[k].l, nxt - pre) + Max - nxt);
          }
        }
      }
    }
  }
  printf("%d\n", ans);
  return 0;
}
