#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int n, s, d, ans, i;
  cin >> n;
  cin >> s >> d;
  ans = s;
  for (i = 1; i < n; i++) {
    cin >> s >> d;
    if (s > ans) {
      ans = s;
      continue;
    } else {
      while (s <= ans) {
        s += d;
      }
      ans = s;
    }
  }
  cout << ans << "\n";
}
