#include <bits/stdc++.h>
using namespace std;
int n;
pair<int, int> q[222];
map<pair<int, int>, int> was;
int solve(int s, int x) {
  if (x == n) return 0;
  if (was.find(make_pair(s, x)) != was.end()) return was[make_pair(s, x)];
  int ret = 0;
  for (int i = x; i < n; i++) {
    int t = q[i].first - max(s, q[i].first - q[i].second);
    int u = q[i].first;
    int h = i;
    for (int j = x; j < n; j++)
      if (j != i) {
        if (q[j].first > u) break;
        h = max(h, j);
        if (q[j].first + q[j].second > u) {
          t += q[j].first + q[j].second - u;
          u = q[j].first + q[j].second;
        }
      }
    t += solve(u, h + 1);
    ret = max(ret, t);
  }
  {
    int t = q[x].second;
    int u = q[x].first + q[x].second;
    int h = x;
    for (int j = x + 1; j < n; j++) {
      if (q[j].first > u) break;
      h = j;
      if (q[j].first + q[j].second > u) {
        t += q[j].first + q[j].second - u;
        u = q[j].first + q[j].second;
      }
    }
    t += solve(u, h + 1);
    ret = max(ret, t);
  }
  was[make_pair(s, x)] = ret;
  return ret;
}
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> q[i].first >> q[i].second;
  sort(q, q + n);
  cout << solve(-2e8, 0) << endl;
  return 0;
}
