#include <bits/stdc++.h>
const int MAXN = 1000 + 10;
int N;
int S[MAXN], D[MAXN];
int main() {
  register int i, j;
  int last = 0;
  scanf("%d", &N);
  for (i = 1; i <= N; ++i) scanf("%d%d", S + i, D + i);
  for (i = 1; i <= N; last = j, ++i)
    for (j = S[i]; j <= last; j += D[i])
      ;
  printf("%d\n", last);
  return 0;
}
