Problem:
Problem H: Winter Bells

The best night ever in the world has come! It's 8 p.m. of December 24th, yes, the night of Cristmas Eve. Santa Clause comes to a silent city with ringing bells. Overtaking north wind, from a sleigh a reindeer pulls she shoot presents to soxes hanged near windows for children.

The sleigh she is on departs from a big christmas tree on the fringe of the city. Miracle power that the christmas tree spread over the sky like a web and form a paths that the sleigh can go on. Since the paths with thicker miracle power is easier to go, these paths can be expressed as undirected weighted graph.

Derivering the present is very strict about time. When it begins dawning the miracle power rapidly weakens and Santa Clause can not continue derivering any more. Her pride as a Santa Clause never excuses such a thing, so she have to finish derivering before dawning.

The sleigh a reindeer pulls departs from christmas tree (which corresponds to 0th node), and go across the city to the opposite fringe (n-1 th node) along the shortest path. Santa Clause create presents from the miracle power and shoot them from the sleigh the reindeer pulls at his full power. If there are two or more shortest paths, the reindeer selects one of all shortest paths with equal probability and go along it.

By the way, in this city there are p children that wish to see Santa Clause and are looking up the starlit sky from their home. Above the i-th child's home there is a cross point of the miracle power that corresponds to c[i]-th node of the graph. The child can see Santa Clause if (and only if) Santa Clause go through the node.

Please find the probability that each child can see Santa Clause.

Input

Input consists of several datasets.

The first line of each dataset contains three integers n, m, p, which means the number of nodes and edges of the graph, and the number of the children. Each node are numbered 0 to n-1.

Following m lines contains information about edges. Each line has three integers. The first two integers means nodes on two endpoints of the edge. The third one is weight of the edge.

Next p lines represent c[i] respectively.

Input terminates when n = m = p = 0.

Output

For each dataset, output p decimal values in same order as input. Write a blank line after that.

You may output any number of digit and may contain an error less than 1.0e-6.

Constraints

3 ≤ n ≤ 100

There are no parallel edges and a edge whose end points are identical.

0 < weight of the edge < 10000

Sample Input

3 2 1
0 1 2
1 2 3
1
4 5 2
0 1 1
0 2 1
1 2 1
1 3 1
2 3 1
1
2
0 0 0

Output for the Sample Input

1.00000000

0.50000000
0.50000000

Solution in C# (judge verdict: Wrong Answer)

using System;
using System.Collections;
using System.Collections.Generic;
 
class TEST{
	static void Main(){
		new Sol().Solve();
	}
}

class Sol{
	public void Solve(){
		
		while(true){
			var d=ria();
			N=d[0];M=d[1];P=d[2];
			if(N==0&&M==0&&P==0)return;
			int Inf=(int)1e9;
			int[][] WF=new int[N][];
			for(int i=0;i<N;i++){
				WF[i]=new int[N];
				for(int j=0;j<N;j++){
					WF[i][j]=(i==j)?0:Inf;
				}
			}
			
			E=new List<Pair>[N];
			for(int i=0;i<N;i++)E[i]=new List<Pair>();
			int[] From=new int[M],To=new int[M],Cost=new int[M];
			
			
			
			for(int i=0;i<M;i++){
				d=ria();
				WF[d[0]][d[1]]=WF[d[1]][d[0]]=d[2];
				From[i]=d[0];To[i]=d[1];Cost[i]=d[2];
			}
			
			for(int k=0;k<N;k++){
				for(int i=0;i<N;i++){
					for(int j=0;j<N;j++){
						WF[i][j]=Math.Min(WF[i][j],WF[i][k]+WF[k][j]);
					}
				}
			}
			
			//0->N-1????????????????????????edge????????????
			for(int i=0;i<M;i++){
				if(WF[From[i]][N-1]==WF[To[i]][N-1]+Cost[i])E[From[i]].Add(new Pair(To[i],Cost[i]));
				if(WF[To[i]][N-1]==WF[From[i]][N-1]+Cost[i])E[To[i]].Add(new Pair(From[i],Cost[i]));
			}
			
			//0->N-1???????????????????????????????????§??????????????????
			//???????????????
			Pair[] tmp=new Pair[N];
			for(int i=0;i<N;i++){
				tmp[i]=new Pair(i,WF[i][N-1]);//???->N-1??????????????¢
			}
			Array.Sort(tmp,(x,y)=>x.Cost>y.Cost?-1:x.Cost<y.Cost?1:0);
			
			long[] dp=new long[N];//dp[i]:0??????i???????????????????????°
			dp[0]=1;
			for(int i=0;i<N;i++){
				int now=tmp[i].Pos;
				foreach(var next in E[now]){
					dp[next.Pos]+=dp[now];
				}
			}
//for(int i=0;i<N;i++)Console.WriteLine("{0}-{1}",tmp[i].Pos,tmp[i].Cost);			
			for(;P>0;P--){
				int c=ri();
				long[] dp2=new long[N];//dp2[i]:c??????i???????????????????????°
				dp2[c]=1;
				for(int i=0;i<N;i++){
					int now=tmp[i].Pos;
					foreach(var next in E[now]){
//Console.WriteLine("now={0},0->now:{1} +now->next;{2} +next->N-1:{3},next={4},C:{5}",now,WF[0][now],next.Cost,WF[next.Pos][N-1],next.Pos,WF[0][N-1]);
						dp2[next.Pos]+=dp2[now];
					}
				}
//Console.WriteLine("0->{0}:{1},->N-1:{2},tot={3}",c,dp[c],dp2[N-1],dp[N-1]);
				Console.WriteLine("{0:F12}",((double)dp[c]/(double)dp[N-1])*(double)dp2[N-1]);
			}
			Console.WriteLine();
		
		}
	}
	
	int N,M,P;
	List<Pair>[] E;
	
	class Pair{
		public int Pos,Cost;
		public Pair(int p,int c){
			Pos=p;Cost=c;
		}
	}
	
	
	

	public Sol(){
	}

	static String rs(){return Console.ReadLine();}
	static int ri(){return int.Parse(Console.ReadLine());}
	static long rl(){return long.Parse(Console.ReadLine());}
	static double rd(){return double.Parse(Console.ReadLine());}
	static String[] rsa(){return Console.ReadLine().Split(' ');}
	static int[] ria(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>int.Parse(e));}
	static long[] rla(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>long.Parse(e));}
	static double[] rda(){return Array.ConvertAll(Console.ReadLine().Split(' '),e=>double.Parse(e));}
}