#include <bits/stdc++.h>
#define int long long
int n,e,k,q;
std::vector<int> voting;
std::vector<std::vector<std::pair<int,int>>> adj;
int dist[5010][(1<<5)+5];
signed main() {
std::cin >> n >> e >> k;
adj.resize(n+3);
for(int i=0;i<k;i++){
int in;std::cin >> in;
voting.push_back(in);
}
for(int i=0;i<e;i++){
int u,v,w;
std::cin >> u >> v >> w;
adj[u].push_back({v,w});
}
std::priority_queue<std::pair<int,std::pair<int,int>>> pq;
std::cin >> q;
while(q--){
int s;
std::cin >> s;
std::vector<int> couponCost;
for(int i=0;i<5;i++){
int in;
std::cin >> in;
if(in==-1)in=1e18;
couponCost.push_back(in);
}
for(int i=0;i<n;i++){
for(int b=0;b<=(1<<5);b++){
dist[i][b]=1e18;
}
}
dist[0][0]=0;
pq.push({-0,{s,0}});
while(!pq.empty()){
int currDist=-pq.top().first;
int currBit=pq.top().second.second;
int currNode=pq.top().second.first;
pq.pop();
for(auto [to,weight]:adj[currNode]){
if(dist[to][currBit]>currDist+weight){
dist[to][currBit]=currDist+weight;
pq.push({-(currDist+weight),{to,currBit}});
}
for(int i=0;i<5;i++){
if((currBit&(1<<i))!=0)continue;
if(dist[to][currBit|(1<<i)]>currDist+couponCost[i]+(weight*(9-i))/10){
dist[to][currBit|(1<<i)]=currDist+couponCost[i]+(weight*(9-i))/10;
pq.push({-(currDist+couponCost[i]+(weight*(9-i))/10),{to,currBit|(1<<i)}});
}
}
}
}
int min = 1e18;
for(int node:voting){
for(int b=0;b<1<<5;b++){
min=std::min(min,dist[node][b]);
}
}
if(min>=1e18)min=-1;
std::cout << min << '\n';
}
}
/*
3 2 1
2
0 1 100
1 2 200
1
0 10 20 1000 2000 -1
*/