#include <bits/stdc++.h>
using namespace std;
const int N = 1008;
int s[N], d[N];
int main() {
  int n;
  cin >> n;
  int res;
  for (int i = 1; i <= n; i++) cin >> s[i] >> d[i];
  int l = 0;
  for (int i = 1; i <= n; i++) {
    int j = 0;
    while (s[i] + j * d[i] <= l) j++;
    res = s[i] + j * d[i];
    l = res;
  }
  cout << res;
}
