#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  cin >> n;
  int pre = 0;
  while (n--) {
    int s, d;
    cin >> s >> d;
    if (s > pre)
      pre = s;
    else
      pre = (d - ((pre + 1 - s) % d)) % d + pre + 1;
  }
  cout << pre << endl;
  return 0;
}
