WALKFAST problem

T = int(input())
for i in range(T):
n,a,b,c,d,p,q,y=list(map(int,input().split()))
x=list(map(int,input().split()))
time1 = (abs(x[a-1] - x[b-1])) * p
temp_time1 = (abs(x[c - 1] - x[a - 1])) * p
temp_time2 = (abs(x[c - 1] - x[d - 1])) * q
temp_time3 = (abs(x[d - 1] - x[b - 1])) * p
if(p>q):
print(time1)
else:
if(temp_time1>y):
print(time1)
else:
if((a<c) and (c<d) and (d<b)) or ((a > c) and (c > d) and (d > b)):
time2=y+temp_time2+temp_time3
print(min(time1,time2))
else:
print(time1)

this is my code i don’t understand what is the problem please help

He solved it: CodeChef: Practical coding for everyone