#include <bits/stdc++.h>
using namespace std;
int n, s, d;
int main() {
  cin.sync_with_stdio(0);
  int last = 0;
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> s >> d;
    for (int j = s;; j += d)
      if (j > last) {
        last = j;
        break;
      }
  }
  cout << last;
  return 0;
}
