#include <bits/stdc++.h>
using namespace std;
const int N = 100 + 10;
int rd() {
  int x = 0, w = 1;
  char ch = 0;
  while (ch < '0' || ch > '9') {
    if (ch == '-') w = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9') {
    x = (x << 3) + (x << 1) + (ch ^ 48);
    ch = getchar();
  }
  return x * w;
}
struct node {
  int x, l;
  bool operator<(const node &bb) const { return x < bb.x; }
} a[N];
int n, f[N][N][2];
int main() {
  n = rd();
  for (int i = 1; i <= n; ++i) a[i].x = rd(), a[i].l = rd();
  sort(a + 1, a + n + 1);
  int ans = 0;
  a[0].x = -(1 << 30), a[0].l = 0;
  for (int i = 0; i <= n; ++i)
    for (int j = 0; j <= i; ++j)
      for (int p = 0; p <= 1; ++p) {
        ans = max(ans, f[i][j][p]);
        int p1 = a[j].x + a[j].l * p;
        int mx = -(1 << 30), o, z;
        for (int k = i + 1; k <= n; ++k)
          for (int q = 0; q <= 1; ++q) {
            int p2 = a[k].x + a[k].l * q;
            if (mx <= p2) mx = p2, o = k, z = q;
            f[k][o][z] =
                max(f[k][o][z], f[i][j][p] + min(a[k].l, p2 - p1) + mx - p2);
          }
      }
  printf("%d\n", ans);
  return 0;
}
