from heapq import heappush, heappop INF = 1<<60 N, M = map(int, input().split()) G = [[] for _ in range(N)] for _ in range(M): u, v, w = map(int, input().split()) u, v = u-1, v-1 G[u].append((v, w)) G[v].append((u, w)) A = list(map(int, input().split())) B = list(map(int, input().split())) C = list(map(int, input().split())) def dijkstra(start): dist = [INF]*N dist[start] = 1 visited = [False]*N que = [(0, start)] while que: d, now = heappop(que) if visited[now]: continue visited[now] = True for next, weight in G[now]: st = (dist[now]+A[now]-1)//A[now]*A[now] cost = weight if st//A[now]%B[now] == 0: cost += C[now] if st+cost < dist[next]: dist[next] = st+cost heappush(que, (dist[next], next)) if st%B[now] == 0: st += A[now] if st+weight < dist[next]: dist[next] = st+weight heappush(que, (dist[next], next)) return dist print(dijkstra(0)[N-1])