#include <bits/stdc++.h>
using namespace std;
int n;
void enter() { cin >> n; }
void process() {
  long long ans = 0, lst = 0;
  while (n--) {
    long long x, y;
    cin >> x >> y;
    long long k = 0;
    while (x + k * y <= lst) {
      ++k;
    }
    ans = max(ans, x + k * y);
    lst = x + k * y;
  }
  cout << ans << '\n';
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  enter();
  process();
  return 0;
}
