#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, cur = 1;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int s, d;
    cin >> s >> d;
    if (cur <= s) {
      cur = s;
    } else {
      int diff = cur - s, mul = diff / d + (diff % d != 0);
      cur = s + mul * d;
    }
    cur++;
  }
  cout << cur - 1 << '\n';
}
