#include <stdio.h>
typedef long long ll;

int main(void) {
  ll i, n, anst = 1, ansa = 1, a, t, now;
  scanf("%lld", &n);
  for(i = 0; i < n; ++i) {
    scanf("%lld%lld", &a, &t);
    now = (anst + t - 1) / t > (ansa + a - 1) / a ? (anst + t - 1) / t : (ansa + a - 1) / a;
    anst = now * t, ansa = now * a;
  }
  printf("%lld", ansa + anst);
  return 0;
}