#include <bits/stdc++.h>
using namespace std;
int cl(double x) {
  int y;
  y = x;
  if (y == x)
    return y + 1;
  else
    return y + 1;
}
int main() {
  int T, x, num, d, i, n, s;
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> s >> d;
    if (i == 1)
      num = s;
    else {
      if (num - s < 0)
        num = s;
      else if ((num - s) == 0)
        num = s + d;
      else {
        x = cl((num - s) * 1.0 / d);
        num = s + d * x;
      }
    }
  }
  cout << num << endl;
  return 0;
}
