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