#include <bits/stdc++.h>
using namespace std;
inline int fr() {
  int ret = 0, sym = 1, c = 0;
  while (!isdigit(c)) sym = c == '-' ? -1 : 1, c = getchar();
  while (isdigit(c)) ret = ret * 10 + c - '0', c = getchar();
  return ret * sym;
}
const int maxn = 1e2 + 5;
int n, irc[114514];
pair<int, int> dt_o[maxn];
int dt_a[maxn], dt_l[maxn];
set<int> dc_s;
map<int, int> dc_m;
int pr_c = 0, pr_p[maxn * 3] = {}, pr_x[maxn][3];
int dp[maxn][maxn * 3] = {};
template <typename T>
inline void maximize(T &a, T b) {
  if (b > a) a = b;
}
int main() {
  n = fr();
  for (int i = 1; i <= (n); ++i) dt_o[i].first = fr(), dt_o[i].second = fr();
  sort(dt_o + 1, dt_o + 1 + n);
  for (int i = 1; i <= (n); ++i)
    dt_a[i] = dt_o[i].first, dt_l[i] = dt_o[i].second;
  for (int i = 1; i <= (n); ++i)
    for (int j = (-1); j <= (1); ++j) dc_s.insert(dt_a[i] + j * dt_l[i]);
  for (auto i = (dc_s).begin(); i != (dc_s).end(); ++i)
    pr_p[dc_m[*i] = ++pr_c] = *i;
  for (int i = 1; i <= (n); ++i)
    for (int j = (0); j <= (2); ++j)
      pr_x[i][j] = dc_m[dt_a[i] + (j - 1) * dt_l[i]];
  for (int i = 1; i <= (n); ++i) {
    for (int j = (pr_x[i][1]); j <= (pr_x[i][2] - 1); ++j)
      maximize(dp[i][pr_x[i][2]], dp[i - 1][j] + pr_p[pr_x[i][2]] - pr_p[j]);
    irc[1] = pr_x[i][1];
    for (int k = (pr_x[i][0]); k <= (pr_x[i][1] - 1); ++k)
      maximize(dp[i][pr_x[i][1]], dp[i - 1][k] + pr_p[pr_x[i][1]] - pr_p[k]);
    for (int j = (i - 1); j >= 1; --j) {
      maximize(irc[1], pr_x[j][2]);
      for (int k = (pr_x[i][0]); k <= (irc[1] - 1); ++k)
        maximize(dp[i][irc[1]], dp[j - 1][k] + pr_p[irc[1]] - pr_p[k]);
    }
    for (int j = 1; j <= (pr_c); ++j) {
      maximize(dp[i][j], dp[i][j - 1]);
      maximize(dp[i][j], dp[i - 1][j]);
    }
  }
  printf("%d", dp[n][pr_c]);
  return 0;
}
