#include <bits/stdc++.h>
using namespace std;
int i, j;
int main() {
  int n, s, d, flag, last;
  cin >> n;
  cin >> s >> d;
  flag = s;
  n--;
  while (n--) {
    cin >> s >> d;
    while (flag >= s) s += d;
    flag = s;
  }
  cout << flag;
}
