import sys
n=int(input())
for i in range(0,n):
try:
s=sys.stdin.readline()
s=s.split()
x=int(s[0])
y=int(s[1])
z=int(s[2])
w=int(s[3])
n=int(s[4])
m=int(s[5])
k=0
dict={1:x,2:y,3:z,4:w}
eat_item=sys.stdin.readline()
eat_item=eat_item.split()
if not eat_item:
pass
for j inrange(0,len(eat_item)):
m=m-k
if int(eat_item[j])==1orint(eat_item[j])==2:
m=m+dict[int(eat_item[j])]
if int(eat_item[j])==3orint(eat_item[j])==4:
m=m-dict[int(eat_item[j])]
if int(eat_item[j])==4:
k=k+n
if int(m)<=0:
print('bye~Rabbit')
break
if int(m)<=0:
print('bye~Rabbit')
elif int(m)>0:
string=""
string=str(m)+"g"
print(string)
except:
break