#include <bits/stdc++.h>
using namespace std;
struct nd {
  int a, l;
} t[2000];
bool operator<(nd a, nd b) { return a.a < b.a; }
int a[200], l[200];
vector<int> v;
map<int, int> mp;
int dp[200][1000], g[1000];
int main() {
  int n = 0;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &a[i], &l[i]);
    t[i].a = a[i], t[i].l = l[i], v.push_back(a[i]), v.push_back(a[i] - l[i]),
    v.push_back(a[i] + l[i]);
  }
  sort(t + 1, t + n + 1);
  for (int i = 1; i <= n; i++) a[i] = t[i].a, l[i] = t[i].l;
  sort(v.begin(), v.end());
  v.erase(unique(v.begin(), v.end()), v.end());
  int m = v.size();
  for (int i = 0; i < m; i++) mp[v[i]] = i;
  for (int i = 1; i <= n; i++) {
    int p = mp[a[i]], r = mp[a[i] + l[i]], x = mp[a[i] - l[i]];
    for (int j = p; j <= r; j++) {
      dp[i][j] = max(dp[i][j], dp[i - 1][p] + (v[j] - v[p]));
    }
    memset(g, 0, sizeof(g));
    int R = p;
    g[R] = max(g[R], dp[i - 1][x] + v[R] - v[x]);
    for (int k = i - 1; k >= 1; k--) {
      R = max(R, mp[a[k] + l[k]]);
      g[R] = max(g[R], dp[k - 1][x] + v[R] - v[x]);
    }
    for (int j = m - 1; j >= x; j--) {
      dp[i][j] = max(dp[i][j], g[j]);
      if (j > 0) g[j - 1] = max(g[j - 1], g[j] - v[j] + v[j - 1]);
    }
    for (int j = 0; j < m; j++) {
      dp[i][j] = max(dp[i][j], dp[i - 1][j]);
      dp[i][j] = max(dp[i][j], dp[i][j - 1]);
    }
  }
  printf("%d\n", dp[n][m - 1]);
}
