#include <bits/stdc++.h>
using namespace std;
const int N = 105;
inline int read() {
  int x = 0, f = 1, ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') {
      f = -1;
    }
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = x * 10 + ch - '0';
    ch = getchar();
  }
  return x * f;
}
struct stu {
  int x, l;
  stu() {}
  stu(int x, int l) : x(x), l(l) {}
};
stu a[N];
int dp[N][N][2];
inline int cmp(stu a, stu b) { return a.x < b.x; }
int main() {
  int n = read();
  for (int i = 1; i <= n; i++) a[i].x = read(), a[i].l = read();
  sort(a + 1, a + n + 1, cmp);
  a[0].x = -(1 << 30);
  int ans = 0;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++)
      for (int p = 0; p < 2; p++) {
        ans = max(ans, dp[i][j][p]);
        int Pr = a[j].x + p * a[j].l;
        for (int k = i + 1, mx = -(1 << 30), x, y; k <= n; k++)
          for (int d = 0; d < 2; d++) {
            int nxt = a[k].x + d * a[k].l;
            if (nxt > mx) mx = nxt, x = k, y = d;
            dp[k][x][y] = max(dp[k][x][y],
                              dp[i][j][p] + min(a[k].l, nxt - Pr) + mx - nxt);
          }
      }
  printf("%d\n", ans);
  return 0;
}
