#include <bits/stdc++.h>
using namespace std;
template <typename T>
void takearray(vector<T> &a, long long int n) {
  T y;
  for (long long int i = 0; i < n; i++) {
    cin >> y;
    a.push_back(y);
  }
}
template <typename T>
void print1d(vector<T> &a) {
  for (long long int i = 0; i < a.size(); i++) {
    cout << a[i] << " ";
  }
  cout << endl;
}
void sieveoferatosthenes(long long int n, vector<long long int> &a) {
  vector<bool> prime(n + 1, true);
  for (long long int p = 2; p * p <= n; p++) {
    if (prime[p] == true) {
      for (long long int i = p * p; i <= n; i += p) prime[i] = false;
    }
  }
  for (long long int p = 2; p <= n; p++)
    if (prime[p]) a.push_back(p);
}
long long int first_BS(vector<long long int> a, long long int low,
                       long long int high, long long int x) {
  while (low <= high) {
    long long int mid = low + (high - low) / 2;
    if ((mid == 0 || x > a[mid - 1]) && a[mid] == x)
      return mid;
    else if (a[mid] < x)
      low = mid + 1;
    else
      high = mid - 1;
  }
  return -1;
}
long long int last_BS(vector<long long int> a, long long int low,
                      long long int high, long long int x) {
  while (low <= high) {
    long long int mid = low + (high - low) / 2;
    if ((mid == a.size() - 1 || x < a[mid + 1]) && a[mid] == x)
      return mid;
    else if (x < a[mid])
      high = mid - 1;
    else
      low = mid + 1;
  }
  return -1;
}
bool sortbool(pair<long long int, long long int> &a,
              pair<long long int, long long int> &b) {
  return a.first < b.first;
}
vector<long long int> numberDivisior(long long int n) {
  vector<long long int> b;
  for (long long int i = 1; i <= sqrt(n); i++) {
    if (n % i == 0) {
      if (n / i == i)
        b.push_back(i);
      else {
        b.push_back(n / i);
        b.push_back(i);
      }
    }
  }
  return b;
}
long long int modiBinarySearch(long long int l, long long int r,
                               long long int k) {
  long long int q, y, mid;
  while (l <= r) {
    mid = l + (r - l) / 2;
    q = (mid * (mid - 1)) / 2;
    y = (mid * (mid + 1)) / 2;
    if (q == k)
      return mid;
    else if (q < k && y > k)
      return mid;
    else if (q > k)
      r = mid - 1;
    else
      l = mid + 1;
  }
  return -1;
}
int32_t main() {
  ios_base::sync_with_stdio(false), cin.tie(0), cout.tie(0);
  ;
  long long int n;
  cin >> n;
  long long int x, y;
  cin >> x >> y;
  long long int q = x;
  for (long long int i = 0; i < n - 1; i++) {
    cin >> x >> y;
    if (x > q)
      q = x;
    else {
      long long int k = ceil((long double)(q - x + 1) / y) * y;
      q = x + k;
    }
  }
  cout << q << endl;
  return 0;
}
