#include <bits/stdc++.h>
int n, now;
int main() {
  scanf("%d", &n);
  for (int i = 0; i < n; i++) {
    int s, d;
    scanf("%d%d", &s, &d);
    if (now < s)
      now = s;
    else {
      if ((now - s) % d == 0)
        now = now + d;
      else
        now = s + (now - s) / d * d + d;
    }
  }
  printf("%d\n", now);
  return 0;
}
