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