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