func_code_string: #include <bits/stdc++.h>   using namespace std;   int head[100005], nxt[200005], v[200005], w[200005], tot = 0;   int fa[100005], rk[100005];   int p[100005], k[100005], n, m;   long long d[100005];   struct node {     int a, b, c;     long long len;   } e[100005];   queue<int> q;   inline int read() {     int x = 0;     char c = getchar();     while (c <  0  || c >  9 ) c = getchar();     while (c >=  0  && c <=  9 ) x = x * 10 + c -  0 , c = getchar();     return x;   }   inline void add(int a, int b, int c) {     tot++;     nxt[tot] = head[a];     head[a] = tot;     v[tot] = b;     w[tot] = c;   }   inline bool cmp(node a, node b) { return a.len < b.len; }   int getf(int a) {     if (a == fa[a]) return a;     return fa[a] = getf(fa[a]);   }   int main() {     int i, num;     n = read();     m = read();     for (i = 1; i <= m; i++) {       e[i].a = read();       e[i].b = read();       e[i].c = read();       add(e[i].a, e[i].b, e[i].c);       add(e[i].b, e[i].a, e[i].c);     }     num = read();     memset(d, 0x3f, sizeof(d));     memset(p, -1, sizeof(p));     for (i = 1; i <= num; i++) {       k[i] = read();       d[k[i]] = 0;       p[k[i]] = k[i];       q.push(k[i]);     }     while (!q.empty()) {       int t = q.front();       q.pop();       for (i = head[t]; i; i = nxt[i]) {         if (d[v[i]] > d[t] + w[i]) {           d[v[i]] = d[t] + w[i];           p[v[i]] = p[t];           q.push(v[i]);         }       }     }     for (i = 1; i <= n; i++) {       fa[i] = i;       rk[i] = 1;     }     for (i = 1; i <= m; i++) {       e[i].len = d[e[i].a] + d[e[i].b] + e[i].c;       e[i].a = p[e[i].a];       e[i].b = p[e[i].b];     }     sort(e + 1, e + m + 1, cmp);     long long ans = d[1];     for (i = 1; i <= m; i++) {       int faa = getf(e[i].a), fab = getf(e[i].b);       if (faa == fab) {         continue;       }       ans += e[i].len;       if (rk[faa] > rk[fab]) {         fa[fab] = faa;       } else {         fa[faa] = fab;       }       if (rk[faa] == rk[fab]) rk[fab]++;     }     printf( %lld n , ans);     return 0;   }   