#include <bits/stdc++.h>
using namespace std;
int arr[1000001];
int main() {
  int n, mn = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    int a, b;
    cin >> a >> b;
    for (int j = 0;; j++) {
      if (arr[a + (b * j)] == 0) {
        arr[a + (b * j)] == 1;
        if ((a + (b * j)) > mn) {
          mn = a + (b * j);
          break;
        }
      }
    }
  }
  cout << mn << endl;
}
