#include #include using namespace std; using namespace atcoder; #define rep(i, n) for(int i=0;i<(n);++i) #define rep1(i, n) for(int i=1;i<=(n);i++) #define ll long long using mint = modint998244353; using P = pair; using lb = long double; using T = tuple; #ifdef LOCAL # include # define dbg(...) debug_print::multi_print(#__VA_ARGS__, __VA_ARGS__) #else # define dbg(...) (static_cast(0)) #endif ll op(ll a, ll b){ return a+b; } ll e(){ return 0; } int main() { int n, m, k; cin >> n >> m >> k; const ll INF = 1e18; vector s(k+1, -1); rep(i,k+1){ int t; cin >> t; --t; s[i] = t; } vector> dist(n, vector(n, INF)); rep(i,m){ int u, v, c; cin >> u >> v >> c; --u;--v; dist[u][v] = min(dist[u][v], (ll)c); dist[v][u] = min(dist[v][u], (ll)c); } rep(i,n)dist[i][i] = 0; rep(k,n)rep(i,n)rep(j,n) dist[i][j] = min(dist[i][j], dist[i][k]+dist[k][j]); segtree seg(k+1); dbg(s); rep(i,k) { seg.set(i, dist[s[i]][s[i+1]]); } int q; cin >> q; while(q--){ int t, x, y; cin >> t >> x >> y; if(t==1){ s[x] = --y; if(x-1>=0) { seg.set(x-1, dist[s[x-1]][s[x]]); } if(x+1<=k) { seg.set(x, dist[s[x]][s[x+1]]); } } else{ ll ans = seg.prod(x, y); cout << ans << endl; } } return 0; }