#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, ans = 0;
  cin >> n;
  int s, d;
  cin >> s >> d;
  ans = s;
  n--;
  while (n--) {
    cin >> s >> d;
    while (s <= ans) {
      s = s + d;
    }
    ans = s;
  }
  cout << ans << endl;
  return 0;
}
