#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  int n, x, y, temp = 0;
  cin >> n;
  for (int i = 0; i < n; i++) {
    cin >> x >> y;
    for (int j = x;; j += y)
      if (j > temp) {
        temp = j;
        break;
      }
  }
  cout << temp;
  return 0;
}
