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