#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, d, s;
  cin >> n;
  int** a = new int*[n];
  for (int i = 0; i < n; i++) {
    a[i] = new int[2];
    for (int j = 0; j < 2; j++) cin >> a[i][j];
  }
  d = a[0][0];
  for (int i = 1; i < n; i++) {
    while (a[i][0] <= d) {
      a[i][0] += a[i][1];
    }
    d = a[i][0];
  }
  cout << d;
  return 0;
}
