#include <bits/stdc++.h>
using namespace std;
const int maxn = 1e5 + 20;
int n, s, d, dp[maxn];
int main() {
  cin >> n >> s >> d;
  dp[0] = s;
  for (int i = 1; i < n; i++) {
    cin >> s >> d;
    while (s <= dp[i - 1]) {
      s += d;
    }
    dp[i] += s;
  }
  cout << dp[n - 1];
  return 0;
}
