from heapq import * N, M = map(int, input().split()) G = [[] for i in range(N)] for _ in range(M): U, V, W = map(int, input().split()); 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 f(i, t): k = (t + A[i] - 1) // A[i] return k * A[i] + (min(A[i], C[i]) if k % B[i] == 0 else 0) d = [10 ** 18] * N; que = [] d[0] = 1; heappush(que, (d[0], 0)) while que: dv, v = heappop(que) if d[v] != dv: continue nd = f(v, d[v]) for nv, c in G[v]: if nd + c < d[nv]: d[nv] = nd + c heappush(que, (d[nv], nv)) print(d[-1])