#include <bits/stdc++.h>
using namespace std;
int n;
vector<int> s;
vector<int> d;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    int tmp;
    cin >> tmp;
    s.push_back(tmp);
    cin >> tmp;
    d.push_back(tmp);
  }
  int output = s[0];
  for (int i = 1; i < n; i++) {
    int start = s[i];
    while (start < (output + 1)) {
      start += d[i];
    }
    output = start;
  }
  cout << output << endl;
  return 0;
}
