#include <bits/stdc++.h>
using namespace std;
int n;
struct node {
  int p, len, to, last;
  bool operator<(node const &ano) const { return p < ano.p; }
} A[110];
int f[110][110][2];
void MAX(int &a, int b) {
  if (b > a) a = b;
}
int main() {
  int t = 0;
  while (scanf("%d", &n) == 1) {
    memset(f, 0, sizeof(f));
    memset(A, 0, sizeof(A));
    for (int i = 1; i <= n; ++i) scanf("%d%d", &A[i].p, &A[i].len);
    sort(A + 1, A + n + 1);
    A[0].p = A[0].to = A[0].last = -0x3f3f3f3f;
    int ans = 0;
    for (int i = 0; i <= n; ++i)
      for (int j = 0; j <= i; ++j)
        for (int k = 0; k < 2; ++k) {
          MAX(ans, f[i][j][k]);
          int at = A[j].p + A[j].len * k;
          int far = -1, jjj, kkk;
          for (int jj = i + 1; jj <= n; ++jj)
            for (int kk = 0; kk < 2; ++kk) {
              int to = A[jj].p + A[jj].len * kk;
              if (to > far) far = to, jjj = jj, kkk = kk;
              MAX(f[jj][jjj][kkk],
                  f[i][j][k] + min(A[jj].len, to - at) + far - to);
            }
        }
    printf("%d\n", ans);
  }
  return 0;
}
