#include <bits/stdc++.h>
const int MAXN = 100;
int n;
std::pair<int, int> a[MAXN + 10];
int X[MAXN * 3 + 10], xt;
int get(int first) {
  int l = 1, r = xt;
  while (l <= r) {
    int mid = (l + r) >> 1;
    if (X[mid] < first)
      l = mid + 1;
    else if (X[mid] == first)
      return mid;
    else
      r = mid - 1;
  }
  return -1;
}
long long trans[MAXN + 10][MAXN + 10][MAXN * 3 + 10];
long long dp[MAXN + 10][MAXN * 3 + 10];
void init() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i].first, &a[i].second);
    X[++xt] = a[i].first - a[i].second;
    X[++xt] = a[i].first;
    X[++xt] = a[i].first + a[i].second;
  }
  std::sort(a + 1, a + n + 1);
  std::sort(X + 1, X + xt + 1);
  xt = std::unique(X + 1, X + xt + 1) - X - 1;
  for (int l = 1; l <= n; l++) {
    int li = get(a[l].first - a[l].second), mid = get(a[l].first),
        ri = get(a[l].first + a[l].second);
    for (int j = li; j < mid; j++) trans[l][l][j] = mid;
    for (int j = mid; j <= xt; j++) trans[l][l][j] = ri;
  }
  for (int l = 1; l <= n; l++)
    for (int r = l + 1; r <= n; r++) {
      int le = get(a[r].first - a[r].second), mid = get(a[r].first),
          re = get(a[r].first + a[r].second);
      for (int li = 1; li <= xt; li++)
        for (int c = l; c < r; c++)
          if (trans[l][c][li]) {
            int ri = trans[l][c][li];
            if (mid < li) {
              (trans[l][r][li]) =
                  (((ri)) > ((trans[l][r][li])) ? ((ri)) : ((trans[l][r][li])));
              (trans[l][r][le]) =
                  (((mid)) > ((trans[l][r][le])) ? ((mid))
                                                 : ((trans[l][r][le])));
            } else if (mid < ri)
              (trans[l][r][((li) < (le) ? (li) : (le))]) =
                  (((ri)) > ((trans[l][r][((li) < (le) ? (li) : (le))]))
                       ? ((ri))
                       : ((trans[l][r][((li) < (le) ? (li) : (le))])));
            else if (le <= ri)
              (trans[l][r][((li) < (le) ? (li) : (le))]) =
                  (((mid)) > ((trans[l][r][((li) < (le) ? (li) : (le))]))
                       ? ((mid))
                       : ((trans[l][r][((li) < (le) ? (li) : (le))])));
            else {
              (trans[l][r][li]) =
                  (((ri)) > ((trans[l][r][li])) ? ((ri)) : ((trans[l][r][li])));
              (trans[l][r][le]) =
                  (((mid)) > ((trans[l][r][le])) ? ((mid))
                                                 : ((trans[l][r][le])));
            }
            if (re < li) {
              (trans[l][r][li]) =
                  (((ri)) > ((trans[l][r][li])) ? ((ri)) : ((trans[l][r][li])));
              (trans[l][r][mid]) =
                  (((re)) > ((trans[l][r][mid])) ? ((re))
                                                 : ((trans[l][r][mid])));
            } else if (re < ri)
              (trans[l][r][((li) < (mid) ? (li) : (mid))]) =
                  (((ri)) > ((trans[l][r][((li) < (mid) ? (li) : (mid))]))
                       ? ((ri))
                       : ((trans[l][r][((li) < (mid) ? (li) : (mid))])));
            else if (mid <= ri)
              (trans[l][r][((li) < (mid) ? (li) : (mid))]) =
                  (((re)) > ((trans[l][r][((li) < (mid) ? (li) : (mid))]))
                       ? ((re))
                       : ((trans[l][r][((li) < (mid) ? (li) : (mid))])));
            else {
              (trans[l][r][li]) =
                  (((ri)) > ((trans[l][r][li])) ? ((ri)) : ((trans[l][r][li])));
              (trans[l][r][mid]) =
                  (((re)) > ((trans[l][r][mid])) ? ((re))
                                                 : ((trans[l][r][mid])));
            }
          }
      for (int li = 1; li <= xt; li++)
        trans[l][r][li] =
            ((trans[l][r][li]) > (trans[l][r][li - 1]) ? (trans[l][r][li])
                                                       : (trans[l][r][li - 1]));
    }
  long long ans = 0;
  for (int i = 0; i < n; i++)
    for (int j = i + 1; j <= n; j++) {
      long long MAX = 0;
      for (int l = 1; l <= xt; l++) {
        int r = trans[i + 1][j][l];
        MAX = ((MAX) > (dp[i][l]) ? (MAX) : (dp[i][l]));
        for (int k = l; k <= r; k++) {
          dp[j][k] = ((dp[j][k]) > (MAX + X[k] - X[l]) ? (dp[j][k])
                                                       : (MAX + X[k] - X[l]));
          ans = ((ans) > (dp[j][k]) ? (ans) : (dp[j][k]));
        }
      }
    }
  std::cout << ans << std::endl;
  return;
}
int main() {
  init();
  return 0;
}
