#include <bits/stdc++.h>
int main() {
  int n;
  scanf("%d", &n);
  int day = 1;
  int start, pause;
  for (int i = 1; i <= n; i++) {
    scanf("%d%d", &start, &pause);
    for (;; day++) {
      if (day >= start && (day - start) % pause == 0) break;
    }
    day++;
  }
  printf("%d\n", day - 1);
  return 0;
}
