#include using namespace std; using SS = long long; class SegmentTree{ public: int siz = 1; vector dat; SS op(SS a, SS b){return a+b;} SS e(){return 0;} void renew (SS &a,SS x){ //a = op(a,x); a = x; //その他. } void make(int N){ while(siz < N) siz *= 2; dat.resize(siz*2,e()); } void make2(int N,vector &A){ make(N); for(int i=0; i=0; i--) dat.at(i) = op(dat.at(i*2+1),dat.at(i*2+2)); } void update(int pos,SS x){ pos = pos+siz-1; renew(dat.at(pos),x); while(pos != 0){ pos = (pos-1)/2; dat.at(pos) = op(dat.at(pos*2+1),dat.at(pos*2+2)); } } SS findans(int L, int R, int a, int b, int u){ if(R <= a || b <= L) return e(); if(L <= a && b <= R) return dat.at(u); return op(findans(L,R,a,(a+b)/2,u*2+1),findans(L,R,(a+b)/2,b,u*2+2)); } SS get(int pos){return dat.at(pos+siz-1);} SS rangeans(int l, int r){return findans(l,r,0,siz,0);} SS allrange(){return findans(0,siz,0,siz,0);} //ノーマルセグ木 二分探索は実装してない. }; int main() { ios_base::sync_with_stdio(false); cin.tie(nullptr); int N,M,K; cin >> N >> M >> K; vector S(K+1); for(auto &s : S) cin >> s,s--; long long inf = 1e18; vector> dist(N,vector(N,inf)); for(int i=0; i> u >> v; u--; v--; int w; cin >> w; dist.at(u).at(v) = w; dist.at(v).at(u) = w; } for(int i=0; i time(K); for(int i=0; i> Q; while(Q--){ int t,x,y; cin >> t >> x >> y; if(t == 1){ y--; if(x) Z.update(x-1,dist.at(S.at(x-1)).at(y)); if(x != K) Z.update(x,dist.at(y).at(S.at(x+1))); S.at(x) = y; } if(t == 2) cout << Z.rangeans(x,y) << endl; } }