#include <bits/stdc++.h>
using namespace std;
const int N = 305;
int n, b[N], g[N], f[N][N];
struct node {
  int x, y, z;
} a[N];
bool cmp(const node &x, const node &y) { return x.x < y.x; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++)
    scanf("%d%d", &a[i].x, &a[i].y),
        a[i].z = a[i].x + a[i].y, a[i].y = a[i].x - a[i].y, b[++b[0]] = a[i].x,
        b[++b[0]] = a[i].y, b[++b[0]] = a[i].z;
  sort(b + 1, b + b[0] + 1), b[0] = unique(b + 1, b + b[0] + 1) - b - 1,
                             sort(a + 1, a + n + 1, cmp);
  for (int i = 1; i <= n; i++) {
    a[i].x = lower_bound(b + 1, b + b[0] + 1, a[i].x) - b,
    a[i].y = lower_bound(b + 1, b + b[0] + 1, a[i].y) - b,
    a[i].z = lower_bound(b + 1, b + b[0] + 1, a[i].z) - b,
    memset(g, 0, sizeof(g));
    int x = a[i].x;
    g[x] = f[i - 1][a[i].y] + b[x] - b[a[i].y];
    for (int j = i - 1; j; j--)
      x = max(x, a[j].z), g[x] = max(g[x], f[j - 1][a[i].y] + b[x] - b[a[i].y]);
    for (int j = b[0]; j >= a[i].y; j--)
      g[j - 1] = max(g[j - 1], g[j] - b[j] + b[j - 1]), f[i][j] = g[j];
    for (int j = a[i].x; j <= a[i].z; j++)
      f[i][j] = max(f[i][j], f[i - 1][a[i].x] + b[j] - b[a[i].x]);
    for (int j = 1; j <= b[0]; j++)
      f[i][j] = max(f[i][j], max(f[i - 1][j], f[i][j - 1]));
  }
  printf("%d", f[n][b[0]]);
  return 0;
}
