#include <bits/stdc++.h>
using namespace std;
int n, ans, l;
bool T[1001010];
pair<int, int> A[1010];
int main() {
  cin >> n;
  for (int i = 0; i < n; i++) cin >> A[i].first >> A[i].second;
  for (int i = 0; i < n; i++) {
    int c = A[i].first;
    while (T[c] || c <= l) c += A[i].second;
    ans = max(ans, c);
    T[c] = true;
    l = c;
  }
  cout << ans;
  return 0;
}
