#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int cur = 0;
  for (int i = 0; i < n; ++i) {
    int a, b;
    cin >> a >> b;
    if (a > cur) {
      cur = a;
    } else {
      ++cur;
      while ((cur - a) % b != 0) {
        ++cur;
      }
    }
  }
  cout << cur << endl;
}
