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 Ruby (judge verdict: Wrong Answer)

### constant

MAX_INT = 1 << 30

### subroutines

def count_routes(k, prevs)
  return $counts[k] if ! $counts[k].nil?

  count = 0

  for prv in prevs[k]
    count += count_routes(prv, prevs)
  end

  $counts[k] = count
end

### main

loop do
  n, m, pn = gets.split.map(&:to_i)
  break if (n | m | pn) == 0

  nbrs = n.times.map{[]}
  edges = n.times.map{[]}

  m.times do
    i, j, w = gets.split.map(&:to_i)
    nbrs[i] << j
    nbrs[j] << i
    edges[i][j] = edges[j][i] = w
  end
  #p nbrs
  #p edges

  cis = pn.times.map{gets.to_i}
  #p cis

  dists = n.times.map{MAX_INT}
  prevs = n.times.map{[]}

  dists[0] = 0
  q = [0]

  while ! q.empty?
    u = q.min{|a, b| dists[a] <=> dists[b]}
    q.delete(u)

    next if u == n - 1

    du = dists[u]

    for v in nbrs[u]
      dv = dists[v]
      ndv = du + edges[u][v]

      if dv > ndv
        dists[v] = ndv
        prevs[v] = [u]
        if dv >= MAX_INT
          q << v
        end
      elsif dv == ndv
        prevs[v] << u
      end
    end
  end
  #p prevs

  $counts = n.times.map{nil}
  $counts[0] = 1

  total = count_routes(n - 1, prevs)
  $counts[0] = total
  #p $counts

  for ci in cis
    puts "%.8f" % ($counts[ci].to_f / total)
  end
  puts
end