#include <bits/stdc++.h>
using namespace std;
int minimumGreater(int s1, int d1, int a) {
  if (a - s1 >= 0) {
    int m = (a - s1) / d1 + 1;
    return s1 + m * d1;
  } else {
    return s1;
  }
}
int main() {
  int n;
  int s, d;
  cin >> n;
  vector<int> valueOfS;
  vector<int> valueOfD;
  for (int i = 0; i < n; i++) {
    cin >> s >> d;
    valueOfS.push_back(s);
    valueOfD.push_back(d);
  }
  int currentDay = valueOfS[0];
  for (int i = 1; i < n; i++) {
    currentDay = minimumGreater(valueOfS[i], valueOfD[i], currentDay);
  }
  cout << currentDay;
}
