def search(num, money, routes, nowTime): minTime = 10000000000 time = minTime*2 for i in xrange(0,routes): if (x[i][1] == num) & (x[i][2] <= money): if x[i][0] == 1: time = x[i][3] else: time = search(x[i][0], money - x[i][2], i, nowTime+x[i][3]) if time < minTime: minTime = time return minTime+nowTime n = input() c = input() v = input() s = map(int, raw_input().split()) t = map(int, raw_input().split()) y = map(int, raw_input().split()) m = map(int, raw_input().split()) x = sorted(zip(s,t,y,m), key=lambda x:x[1]) result = search(n,c,v,0) if result == 10000000000: result = -1 print result