a=int(input())for i in range(a):b=input().split(' ')b=[int(i) for i in b]try:sum=b[-1]p=0c=input()c=c.split(' ')c=[int(i) for i in c]for i in range(len(c)):sum-=p*b[4]if sum<=0:print('bye~Rabbit')breakif c[i]==0:continueelif c[i]==1:sum+=b[0]elif c[i]==2:sum+=b[1]elif c[i]==3:sum-=b[2]else:sum-=b[3]p=p+1if sum>0:print(str(sum)+'g')except:print(str(b[-1])+'g')continue
簡單