#include #include using namespace std; using namespace atcoder; //using mint = modint998244353; //const int mod = 998244353; //using mint = modint1000000007; //const int mod = 1000000007; //const int INF = 1e9; const long long LINF = 1e18; #define rep(i, n) for (int i = 0; i < (n); ++i) #define rep2(i,l,r)for(int i=(l);i<(r);++i) #define rrep(i, n) for (int i = (n-1); i >= 0; --i) #define rrep2(i,l,r)for(int i=(r-1);i>=(l);--i) #define all(x) (x).begin(),(x).end() #define allR(x) (x).rbegin(),(x).rend() #define P pair template inline bool chmax(A & a, const B & b) { if (a < b) { a = b; return true; } return false; } template inline bool chmin(A & a, const B & b) { if (a > b) { a = b; return true; } return false; } template void warshallFloyd(int n, std::vector> &d, T inf) { for (int k = 0; k < n; ++k)for (int i = 0; i < n; ++i)for (int j = 0; j < n; ++j) { if (inf == d[i][k] || inf == d[k][j])continue; d[i][j] = std::min(d[i][j], d[i][k] + d[k][j]); } } long long op(long long a, long long b) { return a + b; } long long e() { return 0; } int main() { ios::sync_with_stdio(false); cin.tie(nullptr); int n, m, k; cin >> n >> m >> k; vectors(k + 1); rep(i, k + 1)cin >> s[i], s[i]--; vector d(n, vector(n, LINF)); rep(i, n)d[i][i] = 0; rep(i, m) { int a, b, c; cin >> a >> b >> c; a--, b--; d[a][b] = c; d[b][a] = c; } warshallFloyd(n, d, LINF); vectora(k); rep(i, k)a[i] = d[s[i]][s[i + 1]]; segtreeseg(a); int q; cin >> q; while (q--) { int t, x, y; cin >> t >> x >> y; if (1 == t) { y--; s[x] = y; if (0 != x) { seg.set(x - 1, d[s[x - 1]][s[x]]); } if (k - 1 != x) { seg.set(x, d[s[x]][s[x + 1]]); } } else { long long ans = seg.prod(x, y); //rep2(i, x, y) { // ans += d[s[i]][s[i + 1]]; //} cout << ans << endl; } } return 0; }