#include <bits/stdc++.h>
using namespace std;
long long hasil, x, y, n, i, pos;
int main() {
  cin >> n;
  pos = 0;
  for (i = 0; i < n; i++) {
    cin >> x >> y;
    while (x <= pos) x += y;
    pos = x;
  }
  cout << pos << endl;
}
