#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000007;
long long powmod(long long a, long long b) {
  long long res = 1;
  a %= mod;
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % mod;
    a = a * a % mod;
  }
  return res;
}
const int N = 310;
vector<int> pos;
int n, m, a[N], l[N], pm[N], pl[N], pr[N];
long long dp[N][N][N], ans;
inline void upd(long long &a, long long b) {
  if (a < b) a = b;
}
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    scanf("%d%d", a + i, l + i);
    pos.push_back(a[i]);
    pos.push_back(a[i] + l[i]);
    pos.push_back(a[i] - l[i]);
  }
  sort((pos).begin(), (pos).end());
  pos.erase(unique((pos).begin(), (pos).end()), pos.end());
  for (int i = 0; i < n; i++) {
    pm[i] = lower_bound((pos).begin(), (pos).end(), a[i]) - pos.begin();
    pl[i] = lower_bound((pos).begin(), (pos).end(), a[i] - l[i]) - pos.begin();
    pr[i] = lower_bound((pos).begin(), (pos).end(), a[i] + l[i]) - pos.begin();
  }
  m = ((int)(pos).size());
  for (int i = 0; i < m; i++)
    for (int j = 0; j < m; j++)
      for (int k = 0; k < m; k++) dp[i][j][k] = -(1ll << 60);
  for (int k = 0; k < m; k++) dp[0][0][k] = 0;
  for (int i = 0; i < m - 1; i++) {
    int ps = -1;
    for (int j = 0; j < n; j++)
      if (pm[j] == i) ps = j;
    for (int j = 0; j < m; j++)
      for (int k = 0; k < m; k++)
        if (dp[i][j][k] >= 0) {
          if (ps == -1) {
            upd(dp[i + 1][j][k],
                dp[i][j][k] +
                    (j >= i + 1 || k <= i ? (pos[i + 1] - pos[i]) : 0));
          } else {
            upd(dp[i + 1][max(j, pr[ps])][k],
                dp[i][j][k] + pos[i + 1] - pos[i]);
            if (k == pl[ps]) {
              for (int l = k; l < m; l++)
                upd(dp[i + 1][max(j, i)][l],
                    dp[i][j][k] +
                        ((j >= i + 1 || l <= i) ? (pos[i + 1] - pos[i]) : 0));
            }
          }
        }
  }
  ans = 0;
  for (int i = 0; i < m; i++) upd(ans, dp[m - 1][i][m - 1]);
  printf("%I64d\n", ans);
}
