#include <bits/stdc++.h>
using std::max;
using std::min;
using std::sort;
int n, ans, dp[120][120][2];
struct Point {
  int x, l;
  bool operator<(Point b) const { return x < b.x; }
} point[110];
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) scanf("%d%d", &point[i].x, &point[i].l);
  sort(point + 1, point + n + 1);
  point[0].x = -1e8;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++)
      for (int di = 0; di <= 1; di++) {
        ans = max(ans, dp[i][j][di]);
        int pre = point[j].x + point[j].l * di;
        for (int k = i + 1, Max = -1e8, a, b; k <= n; k++)
          for (int di2 = 0; di2 <= 1; di2++) {
            int nxt = point[k].x + point[k].l * di2;
            if (nxt > Max) Max = nxt, a = k, b = di2;
            dp[k][a][b] =
                max(dp[k][a][b],
                    dp[i][j][di] + min(point[k].l, nxt - pre) + Max - nxt);
          }
      }
  printf("%d\n", ans);
}
