import sys, time, random from collections import deque, Counter, defaultdict input = lambda: sys.stdin.readline().rstrip() ii = lambda: int(input()) mi = lambda: map(int, input().split()) li = lambda: list(mi()) inf = 2 ** 61 - 1 mod = 998244353 import heapq def Dijkstra(s, graph): n = len(graph) dist = [inf] * n dist[s] = 0 hq = [(0, s)] heapq.heapify(hq) while hq: c, now = heapq.heappop(hq) if c > dist[now]: continue for to, cost in graph[now]: if dist[now] + cost < dist[to]: dist[to] = cost + dist[now] heapq.heappush(hq, (dist[to], + to)) return dist n, m, q = mi() assert 1 <= n <= 10 ** 3 and 1 <= m <= 10 ** 3 and 1 <= q <= 10 ** 3 graph = [[] for _ in range(n)] EDGE = [] for _ in range(m): u, v, c = mi() assert 1 <= u <= n and 1 <= v <= n and -10 ** 3 <= c <= 10 ** 3 assert u != v u -= 1 v -= 1 c *= -1 EDGE.append((u, v, c)) graph[u].append((v, c)) #ベルマンフォード法 dist = [inf] * n dist[0] = 0 for _ in range(n): for j in range(n): for to, c in graph[j]: if dist[to] > dist[j] + c: dist[to] = dist[j] + c for i in range(n): for to, c in graph[j]: assert dist[to] <= dist[j] + c graph2 = [[] for _ in range(n)] EDGE2 = [] d1 = dist[n - 1] for u, v, c in EDGE: assert c + dist[u] - dist[v] >= 0 EDGE2.append((u, v, c + dist[u] - dist[v])) graph2[u].append((v, c + dist[u] - dist[v])) onoff = [1] * m E = li() for e in E: assert 1 <= e <= m e -= 1 if onoff[e]: onoff[e] = 0 graph2[EDGE2[e][0]].remove((EDGE2[e][1], EDGE2[e][2])) else: onoff[e] = 1 graph2[EDGE2[e][0]].append((EDGE2[e][1], EDGE2[e][2])) dist = Dijkstra(0, graph2) if dist[n - 1] == inf: print('NaN') else: print(-(dist[n - 1] + d1))