#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  while (cin >> n) {
    int ans = 0;
    while (n--) {
      int x, y;
      cin >> x >> y;
      if (ans < x)
        ans = x;
      else {
        while (x <= ans) x += y;
        ans = x;
      }
    }
    cout << ans << endl;
  }
}
