#include <bits/stdc++.h>
using namespace std;
int main() {
  int n, i, v[1001], v1[1001];
  cin >> n;
  for (i = 1; i <= n; i++) {
    cin >> v[i];
    cin >> v1[i];
  }
  int j = 0;
  for (i = 1; i <= n; i++) {
    if (v[i] <= j) {
      while (v[i] <= j) {
        v[i] = v[i] + v1[i];
      }
    }
    j = v[i];
  }
  cout << j;
  return 0;
}
