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