#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  int day = 1;
  int s[1002];
  int d[1002];
  cin >> n;
  for (int i = 0; i < n; i++) cin >> s[i] >> d[i];
  for (int i = 0; i < n; i++) {
    while ((day - s[i]) % d[i] != 0 || day < s[i]) day++;
    day++;
  }
  day--;
  cout << day << endl;
  return 0;
}
