import java.io.*; import java.util.*; import java.util.function.*; import java.util.stream.*; public class Main { public static void main(String[] args) throws Exception { Scanner sc = new Scanner(); int n = sc.nextInt(); int m = sc.nextInt(); int k = sc.nextInt(); int[] stamps = new int[k + 1]; for (int i = 0; i <= k; i++) { stamps[i] = sc.nextInt() - 1; } long[][] distances = new long[n][n]; for (int i = 0; i < n; i++) { Arrays.fill(distances[i], Long.MAX_VALUE / 2); distances[i][i] = 0; } for (int i = 0; i < m; i++) { int a = sc.nextInt() - 1; int b = sc.nextInt() - 1; int c = sc.nextInt(); distances[a][b] = c; distances[b][a] = c; } for (int i = 0; i < n; i++) { for (int j = 0; j < n; j++) { for (int t = 0; t < n; t++) { distances[j][t] = Math.min(distances[j][t], distances[j][i] + distances[i][t]); } } } BinaryIndexedTree bit = new BinaryIndexedTree(k + 1); long[] costs = new long[k + 1]; for (int i = 1; i <= k; i++) { costs[i] = distances[stamps[i - 1]][stamps[i]]; bit.add(i, costs[i]); } int q = sc.nextInt(); StringBuilder sb = new StringBuilder(); while (q-- > 0) { if (sc.nextInt() == 1) { int x = sc.nextInt(); int y = sc.nextInt() - 1; if (x > 0) { bit.add(x, -costs[x]); costs[x] = distances[stamps[x - 1]][y]; bit.add(x, costs[x]); } if (x < k) { bit.add(x + 1, -costs[x + 1]); costs[x + 1] = distances[y][stamps[x + 1]]; bit.add(x + 1, costs[x + 1]); } stamps[x] = y; } else { int x = sc.nextInt(); int y = sc.nextInt(); sb.append(bit.getSum(x + 1, y)).append("\n"); } } System.out.print(sb); } } class BinaryIndexedTree { int size; long[] tree; public BinaryIndexedTree(int size) { this.size = size; tree = new long[size]; } public void add(int idx, long value) { int mask = 1; while (idx < size) { if ((idx & mask) != 0) { tree[idx] += value; idx += mask; } mask <<= 1; } } public long getSum(int from, int to) { return getSum(to) - getSum(from - 1); } public long getSum(int x) { int mask = 1; long ans = 0; while (x > 0) { if ((x & mask) != 0) { ans += tree[x]; x -= mask; } mask <<= 1; } return ans; } }class Scanner { BufferedReader br; StringTokenizer st = new StringTokenizer(""); StringBuilder sb = new StringBuilder(); public Scanner() { try { br = new BufferedReader(new InputStreamReader(System.in)); } catch (Exception e) { } } public int nextInt() { return Integer.parseInt(next()); } public long nextLong() { return Long.parseLong(next()); } public double nextDouble() { return Double.parseDouble(next()); } public String next() { try { while (!st.hasMoreTokens()) { st = new StringTokenizer(br.readLine()); } } catch (Exception e) { e.printStackTrace(); } finally { return st.nextToken(); } } }