#include <bits/stdc++.h>
using namespace std;
int main() {
  std::ios_base::sync_with_stdio(0);
  std::cin.tie(0);
  cout << fixed << setprecision(11);
  cerr << fixed << setprecision(6);
  long n, s, d, a;
  cin >> n;
  cin >> s >> d;
  n--;
  a = s;
  while (n--) {
    cin >> s >> d;
    long long m = 0LL;
    while (s + m * d <= a) {
      m++;
    }
    a = s + m * d;
  }
  cout << a << endl;
}
