#include <bits/stdc++.h>
using namespace std;
int s, d, n, td, dp;
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> s >> d;
    dp = s;
    while (td >= dp) {
      dp += d;
    }
    td = dp;
  }
  cout << td;
}
