#include <bits/stdc++.h>
int main() {
  int n, i, j, k, m, count = 0;
  scanf("%d", &n);
  for (i = 1; i <= n; i++) {
    int s, d;
    scanf("%d %d", &s, &d);
    for (j = 0;; j++) {
      m = s + (j * d);
      if (m > count) {
        count = m;
        break;
      }
    }
  }
  printf("%d", count);
}
