#include <bits/stdc++.h>
using namespace std;
int N;
int cnt[2000000];
int main() {
  scanf("%d", &N);
  memset(cnt, 0, sizeof(int) * (N + 1));
  int idx = -1;
  for (int i = 0; i < N; i++) {
    int a, b;
    scanf("%d %d", &a, &b);
    while (1) {
      if (idx < a) {
        idx = a;
        break;
      } else
        a += b;
    }
    while (cnt[idx] == 1) {
      idx += b;
    }
    cnt[idx] = 1;
  }
  printf("%d", idx);
}
