def read_data(): N = int(input()) C = int(input()) V = int(input()) S = list(map(int, input().split())) T = list(map(int, input().split())) Y = list(map(int, input().split())) M = list(map(int, input().split())) cost = [[float('inf')] * N for i in range(N)] time = [[float('inf')] * N for i in range(N)] for s, t, y, m in zip(S, T, Y, M): cost[s-1][t-1] = y time[s-1][t-1] = m return N, C, V, cost, time def solve(N, C, V, cost, time): INF = float('inf') dp = [[INF] * (C + 1) for i in range(N)] dp[0][0] = 0 for pos in range(N): cost_pos = cost[pos] time_pos = time[pos] for np in range(pos + 1, N): nc = cost_pos[np] if nc == INF: continue nt = time_pos[np] dp_np = dp[np] for c, m in enumerate(dp[pos]): if m == INF: continue ncc = nc + c if ncc <= C and dp_np[ncc] > nt + m: dp_np[ncc] = nt + m min_time = min(dp[N-1]) if min_time == INF: return -1 else: return min_time if __name__ == '__main__': N, C, V, cost, time = read_data() print(solve(N, C, V, cost, time))