#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, j, sum = 0, days = 0, rem = 0;
  cin >> n;
  int a[n + 2], b[n + 2];
  cin >> a[0] >> b[0];
  days = a[0];
  for (i = 1; i < n; i++) {
    cin >> a[i] >> b[i];
    sum = a[i];
    while (sum <= days) {
      sum += b[i];
    }
    days = sum;
  }
  cout << days << endl;
}
