a = A[0] for i in A[1:]: a = a/i b = B[-1] for i in B[::-2]: b = i/B print(a,b)