#include <bits/stdc++.h>
using namespace std;
int n, s, d, ans;
int main() {
  cin >> n;
  for (int i = 0; i < n; ++i) {
    scanf("%d%d", &s, &d);
    while (s <= ans) s += d;
    ans = s;
  }
  cout << ans;
  return 0;
}
