#include <bits/stdc++.h>
using namespace std;
const int maxn = 110;
pair<int, int> _[maxn];
int n, a[maxn], L[maxn], R[maxn], l[maxn], t[maxn * 3], tot;
int dp[maxn][maxn * 3];
int getid(int x) { return int(lower_bound(t + 1, t + tot + 1, x) - t); }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &_[i].first, &_[i].second),
        t[++tot] = _[i].first, t[++tot] = _[i].first + _[i].second,
        t[++tot] = _[i].first - _[i].second;
  sort(_ + 1, _ + n + 1);
  sort(t + 1, t + tot + 1);
  tot = int(unique(t + 1, t + tot + 1) - t) - 1;
  for (int i = 1; i <= n; i++) {
    a[i] = getid(_[i].first);
    L[i] = getid(_[i].first - _[i].second);
    R[i] = getid(_[i].first + _[i].second);
  }
  for (int i = 0; i < n; i++) {
    for (int j = 1; j <= tot; j++) {
      dp[i + 1][j] = max(dp[i + 1][j], dp[i][j]);
      if (R[i + 1] > j)
        dp[i + 1][R[i + 1]] = max(dp[i + 1][R[i + 1]],
                                  dp[i][j] + t[R[i + 1]] - t[max(j, a[i + 1])]);
      for (int k = i + 1; k <= n; k++) {
        if (a[k] >= j) {
          int mx = a[k];
          for (int l = k - 1; l > i && a[l] >= L[k]; l--) {
            mx = max(mx, R[l]);
          }
          dp[k][mx] = max(dp[k][mx], dp[i][j] + t[mx] - t[max(j, L[k])]);
        }
      }
    }
  }
  int ans = 0;
  for (int i = 1; i <= tot; i++) ans = max(ans, dp[n][i]);
  printf("%d\n", ans);
  return 0;
}
