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