#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, s[1001], d[1001], i, a, S;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> s[i] >> d[i];
  }
  S = s[1];
  for (i = 2; i <= n; i++) {
    if (s[i] <= S) {
      int x = ((S - s[i]) / d[i]) + 1;
      S = s[i] + d[i] * x;
    } else
      S = s[i];
  }
  cout << S;
}
