#include<bits/stdc++.h>
using namespace std;
typedef long long ll;
constexpr int M=1e5+5,mod=998244353;
tuple<ll,int,int>res[500][M];
int n,m,q,x,y,z,ans,tot,block;
vector<pair<int,int>>g[M];ll dp[M];
int a[M],p[M],id[M],vec[M];
int read(){
int x=0;char ch=getchar();
while (!isdigit(ch)) ch=getchar();
while (isdigit(ch)) x=x*10+ch-48,ch=getchar();
return x;
}
void solve(int ql,int qr){
for (int k=1;k<=tot;k++){ int x=vec[k],siz=0;
for (auto [y,z]:g[x]) res[k][++siz]={dp[y]+z,y,z};
nth_element(res[k]+1,res[k]+block,res[k]+siz+1);
}
for (int i=qr;i>=ql;i--){
int x=p[i];dp[x]=1ll<<60;
if (g[x].size()<=block)
for (auto [y,z]:g[x])
dp[x]=min(dp[x],dp[y]+z);
else for (int j=1;j<=block;j++)
dp[x]=min(dp[x],dp[get<1>(res[id[x]][j])]+get<2>(res[id[x]][j]));
}
}
int main(){
n=read();m=read();q=read();
for (int i=1;i<=n;i++) a[i]=read();
for (int i=1;i<=m;i++){
x=read();y=read();z=read();
g[x].push_back({y,z});
g[y].push_back({x,z});
}
block=(int)ceil(sqrt(m));
for (int i=1;i<=n;i++)
if (g[i].size()>block)
vec[++tot]=i,id[i]=tot;
for (int i=1;i<=q;i++) p[i]=read();
for (int i=q;i>0;i-=block) solve(max(i-block,0)+1,i);
for (int i=1;i<=n;i++) ans=(ans+dp[i]%mod*a[i])%mod;
printf("%d\n",ans);
return 0;
}