#include <bits/stdc++.h>
using namespace std;
struct seg {
  int pos, len;
} a[205];
inline bool cmp(seg aa, seg bb) { return aa.pos < bb.pos; }
int dp[205][205], vis[205], ans, jj, b[205], val[205], r, cnt, i, j, k, n, x, y;
map<int, int> p;
int main() {
  cin >> n;
  for (i = 1; i <= n; ++i) cin >> a[i].pos >> a[i].len;
  sort(a + 1, a + n + 1, cmp);
  for (i = 1; i <= n; ++i) b[i] = a[i].pos, b[i + n] = a[i].pos + a[i].len;
  sort(b + 1, b + n + n + 1);
  b[0] = -1;
  for (i = 1; i <= n + n; p[b[i]] = cnt, ++i)
    if (b[i] != b[i - 1]) val[++cnt] = b[i];
  dp[1][1] = dp[1][p[a[1].pos + a[1].len]] = a[1].len;
  val[cnt + 1] = 1e9;
  vis[p[a[1].pos + a[1].len]] = 1;
  for (i = 2; i <= n; ++i) {
    r = p[a[i].pos];
    for (j = 1; j <= cnt; ++j) dp[i][j] = dp[i - 1][j];
    r = p[a[i].pos + a[i].len];
    for (j = 1; j < r; ++j) {
      if (val[j] < a[i].pos)
        dp[i][r] = max(dp[i][r], dp[i - 1][j] + a[i].len);
      else
        dp[i][r] = max(dp[i][r], dp[i - 1][j] + val[r] - val[j]);
    }
    r = p[a[i].pos];
    x = a[i].pos - a[i].len;
    k = i - 1;
    while (k && a[k].pos >= x) {
      x = min(a[k].pos - a[k].len, x), --k;
    }
    dp[i][r] = max(dp[i][r], val[r] - x);
    for (jj = 1; jj <= cnt; ++jj) {
      if (val[jj] <= x)
        dp[i][r] = max(dp[i][r], dp[k][jj] + val[r] - x);
      else
        dp[i][r] = max(dp[i][r], dp[k][jj] + val[r] - val[jj]);
    }
    for (j = r + 1; j <= cnt; ++j) {
      if (vis[j] && a[vis[j]].pos > a[i].pos - a[i].len) {
        x = a[i].pos - a[i].len;
        y = vis[j];
        k = i - 1;
        while (k && a[k].pos >= x) {
          if (k != y) x = min(a[k].pos - a[k].len, x);
          --k;
        }
        dp[i][j] = max(dp[i][j], val[j] - x);
        for (jj = 1; jj <= cnt; ++jj) {
          if (val[jj] <= x)
            dp[i][j] = max(dp[i][j], dp[k][jj] + val[j] - x);
          else
            dp[i][j] = max(dp[i][j], dp[k][jj] + val[j] - val[jj]);
        }
      }
    }
    vis[p[a[i].pos + a[i].len]] = i;
  }
  for (j = 1; j <= cnt; ++j) ans = max(ans, dp[n][j]);
  cout << ans;
}
