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

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