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