Atcoder Problem Help

I need help with this problem to know why my code results in WA in some of the test cases…

Problem Link

from math import *

n = int(input())

t,a = map(int,input().split())

for i in range(n-1):
tr,ar = map(int,input().split())
k = max(ceil(t/tr),ceil(a/ar))
t = ktr
a = k


t = k * tr
a = k * ar