#include using namespace std; using ll = long long; template struct fenwick_tree { using U = T; public: fenwick_tree() : _n(0) {} fenwick_tree(int n) : _n(n), data(n) {} void add(int p, T x) { assert(0 <= p && p < _n); p++; while (p <= _n) { data[p - 1] += U(x); p += p & -p; } } T sum(int l, int r) { assert(0 <= l && l <= r && r <= _n); return sum(r) - sum(l); } private: int _n; std::vector data; U sum(int r) { U s = 0; while (r > 0) { s += data[r - 1]; r -= r & -r; } return s; } }; int main(){ ios::sync_with_stdio(false); cin.tie(0); int n, m, k, u, v, w, Q; cin >> n >> m >> k; vector S(k + 1); vector> A(n, vector(n, 1ll << 60)); for(auto &&v : S) cin >> v, v--; for(int i = 0; i < m; i++){ cin >> u >> v >> w; u--, v--; A[u][v] = A[v][u] = w; } for(int i = 0; i < n; i++) A[i][i] = 0; for(int k = 0; k < n; k++){ for(int i = 0; i < n; i++){ for(int j = 0; j < n; j++){ A[i][j] = min(A[i][j], A[i][k] + A[k][j]); } } } fenwick_tree fw(k); for(int i = 0; i < k; i++){ fw.add(i, A[S[i]][S[i + 1]]); } cin >> Q; while(Q--){ int T, X, Y; cin >> T >> X >> Y; if(T == 1){ Y--; if(X >= 1) fw.add(X - 1, A[S[X - 1]][Y] - A[S[X - 1]][S[X]]); if(X < k) fw.add(X, A[Y][S[X + 1]] - A[S[X]][S[X + 1]]); S[X] = Y; }else{ cout << fw.sum(X, Y) << '\n'; } } }