#include <bits/stdc++.h>
int main() {
  long long int n, i, s[1001], x[1001], d;
  scanf("%lld", &n);
  for (i = 1; i <= n; i++) {
    scanf("%lld %lld", &s[i], &x[i]);
  }
  d = s[1];
  for (i = 2; i <= n; i++) {
    while (s[i] <= d) {
      s[i] = s[i] + x[i];
    }
    d = s[i];
  }
  printf("%lld\n", d);
  return 0;
}
