#include <bits/stdc++.h>
const double pi = acos(-1);
using namespace std;
int n, s, d, ans;
int main() {
  scanf("%d", &n);
  scanf("%d%d", &s, &d);
  ans = s;
  for (int i = (1); i <= (n - 1); ++i) {
    scanf("%d%d", &s, &d);
    int j = 0;
    while (1) {
      int day = s + j * d;
      if (day > ans) {
        ans = day;
        break;
      }
      ++j;
    }
  }
  printf("%d", ans);
  return 0;
}
