from heapq import heapify, heappop, heappush INF = 2**64 N, M = [int(s) for s in input().split()] graph = [[] for _ in range(N)] for _ in range(M): u, v, w = [int(s) for s in input().split()] graph[u - 1].append((v - 1, w)) graph[v - 1].append((u - 1, w)) A = [int(s) for s in input().split()] B = [int(s) for s in input().split()] C = [int(s) for s in input().split()] times = [INF] * N times[0] = 0 visited = [False] * N pq = [(A[0], 0)] while pq: time, curr = heappop(pq) if visited[curr]: continue visited[curr] = True for to, w in graph[curr]: start = (time + A[curr] - 1) // A[curr] * A[curr] ntime = start + w if (start // A[curr]) % B[curr] == 0 and B[curr] >= 2: nstart = start + A[curr] ntime = min(ntime + C[curr], nstart + w) if ntime >= times[to]: continue times[to] = ntime heappush(pq, (ntime, to)) print(times[N - 1])