#include <bits/stdc++.h>
using namespace std;
inline int Read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (!isdigit(ch)) {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (isdigit(ch)) {
    x = (x << 3) + (x << 1) + ch - '0';
    ch = getchar();
  }
  return x * f;
}
int n, f[105][105][2], ans;
pair<int, int> seg[105];
signed main() {
  n = Read();
  for (int i = 1; i <= n; i++) seg[i].first = Read(), seg[i].second = Read();
  sort(seg + 1, seg + n + 1);
  seg[0].first = -1E9;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++) {
      for (int p = 0; p < 2; p++) {
        ans = max(ans, f[i][j][p]);
        int o = seg[j].first + p * seg[j].second, mx = -1E9, x, y;
        for (int k = i + 1; k <= n; k++) {
          for (int q = 0; q < 2; q++) {
            int t = seg[k].first + q * seg[k].second;
            if (t > mx) mx = t, x = k, y = q;
            f[k][x][y] = max(f[k][x][y],
                             f[i][j][p] + min(seg[k].second, t - o) + mx - t);
          }
        }
      }
    }
  cout << ans << endl;
  return 0;
}
