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