#include <bits/stdc++.h>
using namespace std;
int main() {
  cin.tie(0);
  ios::sync_with_stdio(false);
  int n;
  cin >> n;
  vector<int> s(n), d(n);
  for (int i = 0; i < n; i++) cin >> s[i] >> d[i];
  int pos = 1;
  for (int i = 0; i < n; i++) {
    while (true) {
      int a = pos - s[i];
      if (a < 0) {
        pos++;
        continue;
      }
      if (a % d[i] == 0)
        break;
      else
        pos++;
    }
    pos++;
  }
  cout << pos - 1 << endl;
  return 0;
}
