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