#import <stdio.h>
#define MAX(a,b) ((a)<(b)?(b):(a))
typedef long long INT;
INT CEIL(double x) {
    long n = (long)x;
    return n + (((x != n) && (x > 0)) ? 1 : 0);
}

int main(){
    int n;
    scanf("%d",&n);
    INT a,b;
    scanf("%lld %lld",&a,&b);
    for(int i=1;i<n;i++){
        INT c,d;
        scanf("%lld %lld",&c,&d);
        INT k = MAX(CEIL((double)a/c),CEIL((double)b/d));
        a=c*k;
        b=d*k;
    }
    printf("%lld",a+b);
}
