from heapq import * def main(): n, m, fee = list(map(int, input().split())) X = list(map(int, input().split())) Y = list(map(int, input().split())) Z = list(map(int, input().split())) A = list(map(int, input().split())) node = [[] for _ in range(n)] for _ in range(m): u, v, x, y, z = list(map(int, input().split())) node[u-1].append((v-1, x, y, z)) node[v-1].append((u-1, x, y, z)) hq = [] heappush(hq, (0, 0)) inf = 1<<60 D = [inf] *((n+1)*8) N = n*8 ddd = inf def add(u, c): if D[u] > c: D[u] = c heappush(hq, (c, u)) while hq: c, u = heappop(hq) if D[u] < c: continue u, f = u//8, u%8 if u == n: for v in range(n): add(v*8|f, c+A[v]) else: add(u*8|f|1, c+X[u]) add(u*8|f|3, c+Y[u]) add(u*8|f|4, c+Z[u]) if f&4: add(N|f, c+A[u]+fee) for v, x, y, z in node[u]: add(v*8|f, c+x) if f & 1: add(v*8|f, c+y) if f & 2: add(v*8|f, c+z) return min(D[(n-1)*8: n*8]) print(main())