#include #include using namespace std; using ll = long long; const ll linf = 1e18; template bool chmin(T &a, const T &b){ if (a <= b) return false; a = b; return true; } int main(){ ios_base::sync_with_stdio(false); cin.tie(nullptr); int n, m, k; cin >> n >> m >> k; vector> dist(n,vector(n,linf)); for (int i = 0; i < n; i++){ dist[i][i] = 0; } vector s(k+1); for (int i = 0; i <= k; i++){ int v; cin >> v; v--; s[i] = v; } for (int i = 0; i < m; i++){ int u, v; cin >> u >> v; u--, v--; ll w; cin >> w; chmin(dist[u][v],w); chmin(dist[v][u],w); } for (int l = 0; l < n; l++) for (int i = 0; i < n; i++) for (int j = 0; j < n; j++){ chmin(dist[i][j],dist[i][l]+dist[l][j]); } atcoder::fenwick_tree fen(k); auto set = [&](int i, ll x){ ll d = x - fen.sum(i,i+1); fen.add(i,d); }; for (int i = 0; i < k; i++){ 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){ y--; s[x] = y; if (x > 0){ set(x-1,dist[s[x-1]][s[x]]); } if (x < k){ set(x,dist[s[x]][s[x+1]]); } } if (t == 2){ cout << fen.sum(x,y) << '\n'; } } }