#include <bits/stdc++.h>
using namespace std;
const int Maxn = 110;
const int inf = 2147483647;
int read() {
  int x = 0, f = 1;
  char ch = getchar();
  while (ch < '0' || ch > '9') {
    if (ch == '-') f = -1;
    ch = getchar();
  }
  while (ch >= '0' && ch <= '9')
    x = (x << 3) + (x << 1) + (ch ^ 48), ch = getchar();
  return x * f;
}
int n;
struct Node {
  int p, l, r;
} a[Maxn];
bool cmp(Node a, Node b) { return a.p < b.p; }
int b[Maxn * 3], lb = 0, c = 0;
int to[Maxn * 3];
map<int, int> id;
int f[Maxn][Maxn * 3], ans = -inf, mx1[Maxn][Maxn * 3], mx2[Maxn][Maxn * 3];
void cmax(int &x, int y) { x = max(x, y); }
int main() {
  memset(mx1, -63, sizeof(mx1));
  memset(mx2, -63, sizeof(mx2));
  memset(f, 0, sizeof(f));
  n = read();
  for (int i = 1; i <= n; i++) {
    a[i].p = read(), a[i].l = a[i].r = read();
    b[++lb] = a[i].p - a[i].l;
    b[++lb] = a[i].p;
    b[++lb] = a[i].p + a[i].r;
  }
  sort(a + 1, a + 1 + n, cmp);
  sort(b + 1, b + 1 + lb);
  for (int i = 1; i <= lb; i++) {
    if (i == 1 || b[i] != b[i - 1]) c++;
    to[c] = b[i];
    id[b[i]] = c;
  }
  a[0].p = 0;
  for (int i = 0; i <= n; i++) {
    if (!i) {
      f[1][id[a[1].p + a[1].r]] = a[1].r;
      f[1][id[a[1].p]] = a[1].l;
    }
    int mx = a[i].p;
    int ID = id[a[i].p - a[i].l];
    for (int j = i - 1; j >= 0; j--) {
      if (a[i].p - a[i].l <= a[j + 1].p) {
        cmax(f[i][id[mx]], mx + mx2[j][ID]);
        cmax(f[i][id[mx]], mx + mx1[j][ID] - (a[i].p - a[i].l));
      }
      cmax(mx, a[j].p + a[j].r);
    }
    for (int j = 0; j <= c; j++)
      if (j)
        mx1[i][j] = max(mx1[i][j - 1], f[i][j]);
      else
        mx1[i][j] = f[i][j];
    for (int j = c; j >= 0; j--)
      mx2[i][j] = max(mx2[i][j + 1], f[i][j] - to[j]);
    for (int j = 0; j <= c; j++) {
      int p = id[a[i + 1].p + a[i + 1].r];
      if (p > j)
        cmax(f[i + 1][p],
             f[i][j] + a[i + 1].p + a[i + 1].r - max(a[i + 1].p, to[j]));
      cmax(f[i + 1][j], f[i][j]);
    }
  }
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= c; j++) cmax(ans, f[i][j]);
  printf("%d", ans);
}
