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