#include <bits/stdc++.h>
using namespace std;
int power(int a, int b, int c, int ans = 1) {
  for (; b; b >>= 1, a = (long long)a * a % c)
    if (b & 1) ans = (long long)ans * a % c;
  return ans;
}
const int NN = 111;
map<int, int> mp;
pair<int, int> p[NN];
int n;
int calc(int first) {
  int u = upper_bound(p + 1, p + n + 1, pair<int, int>(first, 1 << 30)) - p;
  if (u == n + 1) return 0;
  if (mp.count(first)) return mp[first];
  int ans = 0;
  int L = p[u].first, R = p[u].first + p[u].second;
  for (int i = u + 1; i <= n && p[i].first <= R; i++)
    R = max(p[i].first + p[i].second, R);
  ans = max(R - L + calc(R), ans);
  for (int i = u; i <= n; i++)
    if (p[i].first - p[i].second < p[u].first) {
      L = max(first, p[i].first - p[i].second);
      R = p[i].first;
      for (int j = u; j <= n && p[j].first <= R; j++)
        if (i != j) {
          R = max(R, p[j].first + p[j].second);
        }
      ans = max(ans, R - L + calc(R));
    }
  return mp[first] = ans;
}
int main() {
  ios_base::sync_with_stdio(0);
  cin.tie(0);
  cout.tie(0);
  cin >> n;
  for (int i = 1; i <= n; i++) cin >> p[i].first >> p[i].second;
  sort(p + 1, p + n + 1);
  cout << calc(-(1 << 30)) << endl;
  return 0;
}
