#include <bits/stdc++.h>
using namespace std;
const int MAXN = 110;
struct Line {
  int l, r, p;
};
inline bool operator<(register Line a, register Line b) { return a.p < b.p; }
Line d[MAXN];
vector<int> Array({-0x3f3f3f3f});
int f[MAXN][MAXN << 2], g[MAXN << 2], n, m;
inline int find(register int x) {
  return lower_bound(Array.begin(), Array.end(), x) - Array.begin();
}
int main() {
  ios::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  cin >> n;
  for (register int i = 1, mid, len; i <= n; i++)
    cin >> mid >> len, d[i] = (Line){mid - len, mid + len, mid},
                       Array.push_back(d[i].l), Array.push_back(d[i].r),
                       Array.push_back(d[i].p);
  sort(Array.begin(), Array.end()),
      Array.erase(unique(Array.begin(), Array.end()), Array.end()),
      m = Array.size() - 1;
  for (register int i = 1; i <= n; i++)
    d[i].l = find(d[i].l), d[i].r = find(d[i].r), d[i].p = find(d[i].p);
  sort(d + 1, d + n + 1);
  for (register int i = 1; i <= n; i++) {
    register int L = d[i].l, R = d[i].r, P = d[i].p, now = P;
    memcpy(f[i], f[i - 1], sizeof(f[i])), memset(g, 0, sizeof(g)),
        g[now] = f[i - 1][L] + Array[now] - Array[L];
    for (register int j = i - 1; j; j--)
      now = max(now, d[j].r),
      g[now] = max(g[now], f[j - 1][L] + Array[now] - Array[L]);
    for (register int j = m; j >= L; j--)
      f[i][j] = max(f[i][j], g[j]),
      g[j - 1] = max(g[j - 1], g[j] - Array[j] + Array[j - 1]);
    for (register int j = P; j <= R; j++)
      f[i][j] = max(f[i][j], f[i - 1][P] + Array[j] - Array[P]);
    for (register int j = 1; j <= m; j++) f[i][j] = max(f[i][j], f[i][j - 1]);
  }
  cout << f[n][m] << endl;
  return 0;
}
