#include "bits/stdc++.h" using namespace std; #define REP(i, n) for(ll i = 0;i < n;i++) #define REPR(i, n) for(ll i = n;i >= 0;i--) #define FOR(i, m, n) for(ll i = m;i < n;i++) #define FORR(i, m, n) for(ll i = m;i >= n;i--) #define REPO(i, n) for(ll i = 1;i <= n;i++) #define ll long long #define INF (ll)1ll << 60 #define MINF (-1 * INF) #define ALL(n) n.begin(),n.end() #define MOD (ll)1000000007 #define P pair struct SegTree { //せぐつりー! ll sz; vector dat; SegTree(ll n) { sz = 1; while (sz < n)sz *= 2; dat.resize(2 * sz - 1);// } void update(ll a, ll x) { a += sz - 1;// dat[a] = x; while (a > 0) { a = (a - 1) / 2; dat[a] = dat[a * 2 + 1] + dat[a * 2 + 2];// } } ll query(ll a, ll b, ll k = 0, ll l = 0, ll r = -1) { if (r < 0) r = sz; if (r <= a or b <= l)return 0;// if (a <= l and r <= b)return dat[k];// ll q1, q2; q1 = query(a, b, k * 2 + 1, l, (l + r) / 2); q2 = query(a, b, k * 2 + 2, (l + r) / 2, r); return q1 + q2;// } }; SegTree seg(210000); ll n, m, k, q, ti[210000], s[210000], d[210][210]; int main(){ cin >> n >> m >> k; k++; REP(i, 210){ REP(j, 210){ if(i != j)d[i][j] = INF; } } REP(i, k){ cin >> s[i]; s[i]--; } REP(i, m){ ll a, b, c; cin >> a >> b >> c; a--;b--; d[a][b] = d[b][a] = c; } REP(l, n)REP(i, n)REP(j, n)d[i][j] = min(d[i][j], d[i][l] + d[l][j]); REP(i, k - 1){ seg.update(i, d[s[i]][s[i + 1]]); } cin >> q; REP(qq, q){ ll t; cin >> t; if(t == 1){ ll x, y; cin >> x >> y; y--; if(x != 0)seg.update(x - 1, d[s[x - 1]][y]); if(x != k - 1)seg.update(x, d[s[x + 1]][y]); s[x] = y; } else{ ll l, r; cin >> l >> r; cout << seg.query(l, r)<