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