#include <bits/stdc++.h>
using namespace std;
long long pp = 1000000007;
long long INF = 1000000000;
long long mo(long long a) {
  if (a >= 0 && a < pp) return a;
  a %= pp;
  if (a < 0) a += pp;
  return a;
}
long long powmod(long long a, long long b, long long pp) {
  long long ans = 1;
  for (; b; b >>= 1, a = mo(a * a))
    if (b & 1) ans = mo(ans * a);
  return ans;
}
long long read() {
  long long ans = 0;
  char last = ' ', ch = getchar();
  while (ch < '0' || ch > '9') last = ch, ch = getchar();
  while (ch >= '0' && ch <= '9') ans = ans * 10 + ch - '0', ch = getchar();
  if (last == '-') ans = -ans;
  return ans;
}
pair<int, int> a[210];
int dp[210][210], q[210], n;
int bin(int k) {
  int l = 1, r = q[0];
  while (l < r) {
    int mid = (l + r) / 2;
    if (k <= q[mid])
      r = mid;
    else
      l = mid + 1;
  }
  return l;
}
int main() {
  n = read();
  for (int i = 1; i <= n; i++) a[i].first = read(), a[i].second = read();
  sort(a + 1, a + n + 1);
  q[0] = 0;
  for (int i = 1; i <= n; i++)
    q[++q[0]] = a[i].first, q[++q[0]] = a[i].first + a[i].second;
  q[++q[0]] = -INF;
  sort(q + 1, q + q[0] + 1);
  int top = 1;
  for (int i = 2; i <= q[0]; i++)
    if (q[top] != q[i]) q[++top] = q[i];
  q[0] = top;
  for (int i = 0; i <= n - 1; i++)
    for (int j = 1; j <= q[0]; j++) {
      int Max = -INF;
      for (int k = i + 1; k <= n; k++)
        for (int fl = 0; fl <= 1; fl++) {
          int tt = a[k].first + a[k].second * fl;
          Max = max(Max, tt);
          int t3 = bin(Max);
          dp[k][t3] =
              max(dp[k][t3], dp[i][j] + min(a[k].second, tt - q[j]) + Max - tt);
        }
    }
  int ans = 0;
  for (int i = 1; i <= n; i++)
    for (int j = 1; j <= q[0]; j++) ans = max(ans, dp[i][j]);
  cout << ans << endl;
  return 0;
}
