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