#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n, s, d, cur, i;
  cin >> n;
  cin >> s >> d;
  cur = s;
  for (i = 1; i < n; ++i) {
    cin >> s >> d;
    cur = s + d * ((max(0LL, cur - s + 1) + d - 1) / d);
  }
  cout << cur;
  return 0;
}
