#include <bits/stdc++.h>
const int N = 107;
int read() {
  int x;
  scanf("%d", &x);
  return x;
}
int min(int a, int b) { return a < b ? a : b; }
int max(int a, int b) { return a > b ? a : b; }
int f[N][N][2];
struct node {
  int x, l;
} a[N];
int main() {
  int n = read(), ans = 0;
  for (int i = 1; i <= n; ++i) a[i] = {read(), read()};
  std::sort(a + 1, a + n + 1, [](node a, node b) { return a.x < b.x; }),
      a[0].x = -1e9;
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= i; ++j)
      for (int f1 = 0, l; f1 <= 1; ++f1) {
        ans = max(ans, f[i][j][f1]), l = a[j].x + a[j].l * f1;
        for (int k = i + 1, mx = -1e8, p, o; k <= n; ++k)
          for (int f2 = 0, r; f2 <= 1; ++f2) {
            if ((r = a[k].x + a[k].l * f2) > mx) mx = r, p = k, o = f2;
            f[k][p][o] =
                max(f[k][p][o], f[i][j][f1] + min(a[k].l, r - l) + mx - r);
          }
      }
  printf("%d", ans);
}
