#include <bits/stdc++.h>
using namespace std;
struct line {
  int x, l;
} c[105];
bool cmp(line a, line b) { return a.x < b.x; }
int f[105][105][2];
int main() {
  int n;
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &c[i].x, &c[i].l);
  sort(c + 1, c + n + 1, cmp);
  c[0].x = -1e9;
  int ans = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++)
      for (int p1 = 0; p1 <= 1; p1++) {
        ans = max(ans, f[i][j][p1]);
        int t = c[j].x + p1 * c[j].l, mx = -1e9, id = 0, y = 0;
        for (int k = i + 1; k <= n; k++)
          for (int p2 = 0; p2 <= 1; p2++) {
            int o = c[k].x + p2 * c[k].l;
            if (o > mx) mx = o, id = k, y = p2;
            f[k][id][y] =
                max(f[k][id][y], f[i][j][p1] + min(o - t, c[k].l) + mx - o);
          }
      }
  printf("%d", ans);
  return 0;
}
