#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  long long n;
  cin >> n;
  long long a[n], b[n];
  for (int i = 0; i < n; ++i) {
    cin >> a[i] >> b[i];
  }
  long long ans = a[0];
  for (int j = 1; j < n; ++j) {
    int i = 0;
    while (a[j] + b[j] * i <= ans) {
      i++;
    }
    ans = a[j] + b[j] * i;
  }
  cout << ans;
  return 0;
}
