#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  string second;
  int n;
  cin >> n;
  int ans = 0;
  for (int i = 0; i < n; i++) {
    int second, d;
    cin >> second >> d;
    while (second <= ans) {
      second += d;
    }
    ans = second;
  }
  cout << ans << endl;
  return 0;
}
