#include <bits/stdc++.h>
using namespace std;
const double pi = acos(-1.0);
const double eps = 1e-9;
const long long inf = 1e18;
int toint(string s) {
  int sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
long long tolint(string s) {
  long long sm;
  stringstream ss(s);
  ss >> sm;
  return sm;
}
long long cl(long long a, long long b) {
  if (a % b == 0)
    return a / b;
  else
    return a / b + 1;
}
long long a, b, s, c, d, e, f, g, h, l, m, n, p, q, r, t, u, v, w, x, y, z,
    ara[100005] = {0}, arr[100005] = {0};
int main() {
  cin.tie(0);
  cout.sync_with_stdio(0);
  long long ans = 0;
  cin >> n;
  for (int i = 1; i <= (n); i++) {
    if (i == 1) {
      cin >> s >> d;
      ans = s;
      continue;
    }
    cin >> s >> d;
    if (s >= ans + 1) {
      ans = s;
      continue;
    }
    ans++;
    x = cl(ans - s, d);
    ans = s + x * d;
  }
  cout << ans;
}
