#include <bits/stdc++.h>
using namespace std;
const long long INF = 1e18;
int main() {
  long long n, ans = 0;
  scanf("%lld", &n);
  vector<pair<long long, long long> > a(n);
  for (int i = 0; i < n; ++i) {
    scanf("%lld%lld", &a[i].first, &a[i].second);
    if (i == 0) {
      ans = a[i].first;
    } else {
      while (a[i].first <= ans) {
        a[i].first += a[i].second;
      }
      ans = a[i].first;
    }
  }
  printf("%lld", ans);
  return 0;
}
