#include <bits/stdc++.h>
using namespace std;
const int days[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31};
const int N = 200100;
const double PI = 3.141592653589793238462643;
int second[1100], d[1100], n;
int main() {
  cin >> n;
  for (int i = 1; i <= n; ++i) {
    cin >> second[i] >> d[i];
  }
  int cnt = 1;
  for (int i = 1; i <= 1000000000; ++i) {
    if (i >= second[cnt] && (i - second[cnt]) % d[cnt] == 0) {
      cnt++;
    }
    if (cnt == n + 1) {
      cout << i << endl;
      break;
    }
  }
  return 0;
}
