#include <bits/stdc++.h>
using namespace std;
const int maxn = 105, inf = 1e9;
int n, a[maxn], l[maxn], ans;
pair<int, int> p[maxn];
int f[maxn][maxn * 2];
int R[maxn * 2], m;
int &dp(int i, int x) {
  int j = lower_bound(R, R + m, x) - R;
  return f[i][j];
}
void cmax(int &x, int y) { x = max(x, y); }
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    cin >> p[i].first >> p[i].second;
  }
  sort(p, p + n);
  for (int i = 1; i <= n; ++i) {
    a[i] = p[i - 1].first;
    l[i] = p[i - 1].second;
    R[2 * i - 1] = a[i];
    R[2 * i] = a[i] + l[i];
  }
  R[0] = -inf;
  sort(R, R + 2 * n + 1);
  m = unique(R, R + 2 * n + 1) - R;
  for (int i = 0; i < n; ++i) {
    for (int j = 0; j < m; ++j) {
      int r = max(a[i + 1] + l[i + 1], R[j]);
      cmax(dp(i + 1, r), f[i][j] + r - max(R[j], a[i + 1]));
      for (int k = i + 1, mx = -inf; k <= n; ++k) {
        int r = max(mx, max(R[j], a[k]));
        cmax(dp(k, r), f[i][j] + r - max(R[j], a[k] - l[k]));
        mx = max(mx, a[k] + l[k]);
      }
    }
  }
  for (int i = 1; i <= n + 1; ++i)
    for (int j = 0; j < m; ++j) {
      cmax(ans, f[i][j]);
    }
  cout << ans << endl;
}
