#include <bits/stdc++.h>
using namespace std;
vector<pair<long long int, long long int> > vec;
vector<long long int> vec1;
priority_queue<pair<string, long long int>,
               vector<pair<string, long long int> >,
               greater<pair<string, long long int> > >
    pq;
bool sortbysec(const pair<int, int> &a, const pair<int, int> &b) {
  return (a.second < b.second);
}
set<long long int> sa;
set<long long int> sa1;
map<long long int, long long int> diff, mark, flag;
int main() {
  std::ios::sync_with_stdio(false);
  long long int n, a, b;
  cin >> n;
  for (long long int i = 0; i < n; i++) {
    cin >> a >> b;
    vec.push_back(make_pair(a, b));
  }
  long long int ma = vec[0].first;
  for (long long int i = 1; i < n; i++) {
    while (vec[i].first <= ma) {
      vec[i].first = vec[i].first + vec[i].second;
    }
    ma = vec[i].first;
  }
  cout << ma;
}
