Chefland has all the cities on a straight line. There are $N$ cities in Chefland numbered $1$ to $N$. City $i$ is located at coordinate $x_i$ on the x-axis. Guru wants to travel from city $A$ to city $B$. He starts at time t=0. He has following choices to travel.
- He can walk $1$ metre in $P$ secs.
- There is a train that travels from city $C$ to city $D$ which travels $1$ metre in $Q$ secs which starts at time t=$Y$ secs. Guru can take the train only at city $C$ and leave the train only at city $D$.
Can you help Guru find the minimum time he will need to travel from city $A$ to $B$. Note that you cannot board the train after time t =$Y$.

-----Input:-----
- First line will contain $T$, number of testcases. Then the testcases follow. 
- First line of each testcase contains eight space separated integers $N, A, B, C, D, P, Q, Y $. 
- Second line of each testcase contains $N$ space-separated integers with the $i$-th integer representing $x_i$.

-----Output:-----
For each testcase, output in a single line containing the minimum travel time.

-----Constraints-----
- $1 \leq T \leq 300$
- $2 \leq N \leq 300$
- $-1000 \leq x_i \leq 1000$
- $0 \leq Y \leq 100000$
- $1 \leq A,B,C,D \leq n $
- $A \neq B$
- $C \neq D$
- $1 \leq P, Q \leq 100$
- $x_i < x_j$  if $i < j$

-----Sample Input:-----
1
4 1 3 2 4 3 2 4
1 2 3 4

-----Sample Output:-----
6

-----EXPLANATION:-----
Guru can walk directly in 6 secs.
If Guru takes train, then he will need  atleast 11 secs.

Difficulty: interview

Starter code:

Solutions:
t=int(input())
for _ in range(t):
 n,a,b,c,d,p,q,y=list(map(int,input().split()))
 l=list(map(int,input().split()))
 ans = abs((l[b-1]-l[a-1]))*p
 x=abs(l[c-1]-l[a-1])*p
 if x<=y:
  x=y+abs(l[d-1]-l[c-1])*q+abs(l[b-1]-l[d-1])*p
  ans=min(ans,x)
 print(ans)


t = int(input())
for _ in range(t):
 n,a,b,c,d,p,q,y = list(map(int,input().split()))
 lst = list(map(int,input().split()))
 dist1 = abs(lst[a-1]-lst[b-1])
 walk = dist1*p
 acdist = abs(lst[a-1]-lst[c-1])*p
 dist2 = abs(lst[c-1]-lst[d-1])
 dist3 = abs(lst[b-1]-lst[d-1])
 cdtime = dist2*q
 bdtime = dist3*p
 train = y+cdtime+bdtime
 if(acdist<=y):
  print(min(walk,train))
 else:
  print(walk)
  
  


for t in range(int(input())) :
 n, a, b, c, d, p, q, y = map(int, input().split())
 x = list(map(int, input().split()))
 bf = (abs(x[a-1] - x[b-1])) * p
 bt = (abs(x[a-1] - x[c-1])) * p
 if bt <= y :
  wbt = y + (abs(x[d-1] - x[b-1])) * p + (abs(x[d-1] - x[c-1])) * q
  print(min(bf, wbt))
 else :
  print(bf)

for t in range(int(input())) :
 n, a, b, c, d, p, q, y = map(int, input().split())
 x = list(map(int, input().split()))
 bf = (abs(x[a-1] - x[b-1])) * p
 bt = (abs(x[a-1] - x[c-1])) * p
 if bt <= y :
  wbt = y + (abs(x[d-1] - x[b-1])) * p + (abs(x[d-1] - x[c-1])) * q
  print(min(bf, wbt))
 else :
  print(bf)

# cook your dish here
for _ in range(int(input())) :
 n, a, b, c, d, p, q, y = map(int, input().split())
 x = list(map(int, input().split()))
 walk = (abs(x[a-1] - x[b-1])) * p
 train = (abs(x[a-1] - x[c-1])) * p
 if train <= y :
  walk_train = y + (abs(x[d-1] - x[b-1])) * p + (abs(x[d-1] - x[c-1])) * q
  print(min(walk, walk_train))
 else :
  print(walk)

# cook your dish here
for _ in range(int(input())) :
 n, a, b, c, d, p, q, y = map(int, input().split())
 x = list(map(int, input().split()))
 walk = (abs(x[a-1] - x[b-1])) * p
 train = (abs(x[a-1] - x[c-1])) * p
 if train <= y :
  walk_train = y + (abs(x[d-1] - x[b-1])) * p + (abs(x[d-1] - x[c-1])) * q
  print(min(walk, walk_train))
 else :
  print(walk)

# cook your dish here
t=int(input())
for _ in range(t):
 n, a, b, c, d, p, q, y = list(map(int,input().split()))
 x = list(map(int,input().split()))
 
 time1=p*abs(x[a-1]-x[b-1])
 l=p*abs(x[a-1]-x[c-1])
 if l<=y:
  time2=(q*abs(x[c-1]-x[d-1]))+(p*abs(x[d-1]-x[b-1]))+y
  print(min(time1, time2))
 else:
  print(time1)
# cook your dish here


# cook your dish here
t=int(input())
for _ in range(t):
 n, a, b, c, d, p, q, y = list(map(int,input().split()))
 x = list(map(int,input().split()))
 
 time1=p*abs(x[a-1]-x[b-1])
 l=p*abs(x[a-1]-x[c-1])
 if l<=y:
  time2=(q*abs(x[c-1]-x[d-1]))+(p*abs(x[d-1]-x[b-1]))+y
  print(min(time1, time2))
 else:
  print(time1)


# cook your dish here
t=int(input())
for _ in range(t):
 n, a, b, c, d, p, q, y = map(int,input().split())
 x = list(map(int,input().split()))
 
 time1=p*abs(x[a-1]-x[b-1])
 l=p*abs(x[a-1]-x[c-1])
 if l<=y:
  time2=(q*abs(x[c-1]-x[d-1]))+(p*abs(x[d-1]-x[b-1]))+y
  print(min(time1, time2))
 else:
  print(time1)

# cook your dish here
t=int(input())
for _ in range(t):
 n, a, b, c, d, p, q, y = list(map(int,input().split()))
 x = list(map(int,input().split()))
 
 time1=p*abs(x[a-1]-x[b-1])
 l=p*abs(x[a-1]-x[c-1])
 if l<=y:
  time2=(q*abs(x[c-1]-x[d-1]))+(p*abs(x[d-1]-x[b-1]))+y
  print(min(time1, time2))
 else:
  print(time1)
 
 
   
   
  


# cook your dish here
t=int(input())
for _ in range(t):
 n, a, b, c, d, p, q, y = list(map(int,input().split()))
 x = list(map(int,input().split()))
 
 time1=p*abs(x[a-1]-x[b-1])
 l=p*abs(x[a-1]-x[c-1])
 if l<=y:
  time2=(q*abs(x[c-1]-x[d-1]))+(p*abs(x[d-1]-x[b-1]))+y
  print(min(time1, time2))
 else:
  print(time1)
 
 
   
   
  


t=int(input())
for _ in range(t):
 n,a,b,c,d,p,q,y=map(int,input().split())
 x=list(map(int,input().split()))
 t1=p*abs(x[a-1]-x[b-1])
 if(abs(x[c-1]-x[a-1])*p<=y):
  t2=q*abs(x[c-1]-x[d-1])+abs(x[d-1]-x[b-1])*p+y
  print(min(t1,t2))
 else:
  print(t1)

t=int(input())
for _ in range(t):
 n, a, b, c, d, p, q, y = list(map(int,input().split()))
 x = list(map(int,input().split()))
 
 time1=p*abs(x[a-1]-x[b-1])
 l=p*abs(x[a-1]-x[c-1])
 if l<=y:
  time2=(q*abs(x[c-1]-x[d-1]))+(p*abs(x[d-1]-x[b-1]))+y
  print(min(time1, time2))
 else:
  print(time1)
 
 
   
   
  
 
 

  
 


t=int(input())
for _ in range(t):
 n, a, b, c, d, p, q, y = list(map(int,input().split()))
 x = list(map(int,input().split()))
 
 time1=p*abs(x[a-1]-x[b-1])
 l=p*abs(x[a-1]-x[c-1])
 if l<=y:
  time2=(q*abs(x[c-1]-x[d-1]))+(p*abs(x[d-1]-x[b-1]))+y
  print(min(time1, time2))
 else:
  print(time1)
 
 
   
   
  
 
 

  
 


for _ in range(int(input())) :
 n, a, b, c, d, p, q, y = list(map(int, input().split()))
 x = list(map(int, input().split()))
 walk = (abs(x[a-1] - x[b-1])) * p
 train = (abs(x[a-1] - x[c-1])) * p
 if train <= y :
  walk_train = y + (abs(x[d-1] - x[b-1])) * p + (abs(x[d-1] - x[c-1])) * q
  print(min(walk, walk_train))
 else :
  print(walk)
 


for _ in range(int(input())) :
 n, a, b, c, d, p, q, y = map(int, input().split())
 x = list(map(int, input().split()))
 walk = (abs(x[a-1] - x[b-1])) * p
 train = (abs(x[a-1] - x[c-1])) * p
 if train <= y :
  walk_train = y + (abs(x[d-1] - x[b-1])) * p + (abs(x[d-1] - x[c-1])) * q
  print(min(walk, walk_train))
 else :
  print(walk)

# cook your dish here
for _ in range(int(input())):
 n,a,b,c,d,p,q,y = map(int,input().split())
 x = list(map(int,input().split()))
 w = abs(x[b-1]-x[a-1])*p
 t = abs(x[d-1]-x[c-1])*q + abs(x[d-1]-x[b-1])*p
 if abs(x[c-1]-x[a-1])*p>y:
  print(w)
 else:
  t = t+y
  print(min(t,w))

# cook your dish here
for t in range(int(input())):
 n,a,b,c,d,p,q,y=map(int,input().split())
 l=list(map(int,input().split()))
 foot=(abs(l[b-1]-l[a-1]))*p
 train=0
 if (abs(l[c-1]-l[a-1]))*p>y:
  print(int(foot))
  continue
 else:
  train+=y+((abs(l[d-1]-l[c-1]))*q)+(abs(l[b-1]-l[d-1]))*p
 if train<foot:
  print(int(train))
 else:
  print(int(foot))

# cook your dish here
for _ in range(int(input())):
 n,a,b,c,d,p,q,y=map(int,input().split())
 ar=[int(x) for x in input().split()]
 temp1=abs(ar[a-1]-ar[c-1])*p
 if temp1>y:
  temp1=10**9
 else:
  if temp1==y:
   temp1+=abs(ar[c-1]-ar[d-1])*q +abs(ar[d-1]-ar[b-1])*p
  elif temp1<y:
   temp1+=abs(ar[c-1]-ar[d-1])*q +abs(ar[d-1]-ar[b-1])*p+abs(temp1-y)
 temp2=abs(ar[a-1]-ar[b-1])*p
 print(min(temp1,temp2))

for _ in range(int(input())):
 n,a,b,c,d,p,q,y=map(int,input().split())
 ar=[int(x) for x in input().split()]
 temp1=abs(ar[a-1]-ar[c-1])*p
 if temp1>y:
  temp1=10**9
 else:
  if temp1==y:
   temp1+=abs(ar[c-1]-ar[d-1])*q +abs(ar[d-1]-ar[b-1])*p
  elif temp1<y:
   temp1+=abs(ar[c-1]-ar[d-1])*q +abs(ar[d-1]-ar[b-1])*p+abs(temp1-y)
 temp2=abs(ar[a-1]-ar[b-1])*p
 print(min(temp1,temp2))

from sys import stdin, stdout
from math import gcd
ans = []

for _ in range(int(stdin.readline())):
 n, a, b, c, d, p, q, y = list(map(int, stdin.readline().split()))
 nArr = list(map(int, stdin.readline().split()))
 wT = abs((nArr[b - 1] - nArr[a - 1]) * p)
 WTTT = abs((nArr[c - 1] - nArr[a - 1]) * p)
 if WTTT > y:
  ans.append(str(wT))
  continue
 tT = abs((nArr[c - 1] - nArr[d - 1]) * q)
 tTBCT = abs((nArr[d - 1] - nArr[b - 1]) * p)
 vTT = y + tT + tTBCT
 ans.append(str(wT) if wT < vTT else str(vTT))
stdout.write('\n'.join(ans))


# cook your dish here
for t in range(int(input())):
 n,a,b,c,d,p,q,y=map(int,input().split())
 l=list(map(int,input().split()))
 foot=(abs(l[b-1]-l[a-1]))*p
 train=0
 if (abs(l[c-1]-l[a-1]))*p>y:
  print(int(foot))
  continue
 else:
  train+=y+((abs(l[d-1]-l[c-1]))*q)+(abs(l[b-1]-l[d-1]))*p
 if train<foot:
  print(int(train))
 else:
  print(int(foot))