#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  vector<pair<int, int> > v;
  map<int, int> visited;
  for (int i = 0; i < n; i++) {
    int from, s;
    cin >> from >> s;
    v.push_back({from, s});
  }
  visited[v[0].first] = 1;
  long long time = v[0].first;
  for (int i = 1; i < n; i++) {
    long long temp = time + 1;
    if (temp < v[i].first) temp = v[i].first;
    while (((temp - v[i].first) % v[i].second) != 0) {
      temp++;
    }
    time = temp;
  }
  cout << time;
  return 0;
}
