#include <bits/stdc++.h>
using namespace std;
int main() {
  string s;
  int n, m, l = 0, a[1002] = {0}, c[1002] = {0}, b[1001] = {0}, k = 0, x = -10;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> m >> l;
    if (k <= m)
      k = m + 1;
    else
      k = m + ((k - m + l - 1) / l) * l + 1;
  }
  cout << k - 1;
  return 0;
}
