#include <bits/stdc++.h>
using namespace std;
int main() {
  int n;
  scanf("%d", &n);
  int day = 0;
  for (int i = 0; i < n; i++) {
    int s, d;
    scanf("%d%d", &s, &d);
    for (int j = 0;; j++) {
      if (s + d * j > day) {
        day = s + d * j;
        break;
      }
    }
  }
  cout << day << endl;
  return 0;
}
