#include <bits/stdc++.h>
using namespace std;
using ll = long long;
const int N = 1e6 + 6;
bool seen[N];
int main() {
  int n;
  cin >> n;
  int mx = 0;
  int s, d;
  cin >> s >> d;
  int curr = s;
  seen[curr] = true;
  while (--n) {
    cin >> s >> d;
    while (seen[s] || s < curr) {
      s += d;
    }
    seen[s] = true;
    curr = s;
  }
  cout << curr << '\n';
  return 0;
}
