#include <bits/stdc++.h>
using namespace std;
int dp[110][110][110];
int a[110], b[110], id[110];
int n;
inline int read() {
  int ans = 0;
  char ch = getchar();
  while (ch < '0' || ch > '9') ch = getchar();
  while (ch >= '0' && ch <= '9')
    ans = (ans << 1) + (ans << 3) + ch - '0', ch = getchar();
  return ans;
}
int cmp(int x, int y) { return a[x] < a[y]; }
int main() {
  scanf("%d", &n);
  for (int i = 1; i <= n; i++) a[i] = read(), b[i] = read();
  for (int i = 1; i <= n + 1; i++) id[i] = i;
  sort(id + 1, id + n + 1, cmp);
  a[0] = -1e9;
  a[n + 1] = 1e9;
  for (int i = 0; i <= n; i++)
    for (int j = 0; j <= i; j++)
      for (int k = 0; k < 2; k++) {
        int t = a[id[j]] + b[id[j]] * k, maxx = t, dt = j, dk = k;
        for (int w = i + 1; w <= n + 1; w++)
          for (int h = 0; h < 2; h++) {
            int u = id[w];
            int nt = a[u] + b[u] * h;
            if (maxx < nt) maxx = nt, dt = w, dk = h;
            dp[w][dt][dk] =
                max(dp[w][dt][dk], dp[i][j][k] + min(b[u], nt - t) + maxx - nt);
          }
      }
  printf("%d\n", dp[n + 1][n + 1][0]);
}
