import std.stdio, std.array, std.string, std.conv, std.algorithm; import std.typecons, std.range, std.random, std.math, std.container; import std.numeric, std.bigint, core.bitop; immutable long MOD = 998244353; immutable long inf = 1L << 59; void main() { auto s = readln.split.map!(to!int); auto N = s[0]; auto M = s[1]; auto K = s[2]; auto A = readln.split.map!(to!long).array; auto G = new long[][](N, N); foreach (i; 0..N) G[i][] = inf; foreach (i; 0..M) { s = readln.split.map!(to!int); auto u = s[0] - 1; auto v = s[1] - 1; auto z = s[2]; G[u][v] = G[v][u] = z.to!long; } auto dist = new long[][](N, N); foreach (i; 0..N) foreach (j; 0..N) dist[i][j] = G[i][j]; foreach (i; 0..N) foreach (j; 0..N) foreach (k; 0..N) if (dist[j][i] != inf && dist[i][k] != inf) { dist[j][k] = min(dist[j][k], dist[j][i] + dist[i][k]); } auto dist2 = new long[][](N, 1<