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