#include <bits/stdc++.h>
using namespace std;
long long n;
vector<pair<long long, long long> > d;
int32_t main() {
  cin >> n;
  d.resize(n);
  for (long long i = 0; i < n; i++) cin >> d[i].first >> d[i].second;
  long long curr = 0LL;
  for (long long i = 0; i < n; i++) {
    if (d[i].first > curr)
      curr = d[i].first;
    else {
      long long q = d[i].first;
      while (true) {
        if (q > curr) {
          curr = q;
          break;
        }
        q += d[i].second;
      }
    }
  }
  cout << curr << endl;
}
