Brightness of Brain Contest
Problem H
Time limit: 1 second Memory: 32 MB

Cheapest way

The Problem

``Moutushi Enterprise'' a leading transport company of Bangladesh is quite anxious about their current business status. For some recent months they aren't earning profitable money as they did before. They investigated over it and found that it is the change in the tax policy that caused them so. For this reason they want to reroute their ways and charge the passengers on the cost of that route.

The cost a bus has to bear is the cost of the oil it needs for that journey, along with some money paid on each station it touches. The profit is ten percent of the cost. Then the amount is divided by the total number of sits in the bus and the seat fare is then determined.

You are given the description of the city map, you are to determine the cheapest way of the map and the seat fare each passenger have to bear.
 

The Input

The first line of the input indicates the number of map to process. Each map contains three sections. Section A contains the stations that the map contains. First line of this section is an integer ``nStation'' (0<`nStation'<20) indicating number of stations the path have. Next `nStation' line contains station name and the money that have to pay to pass through this station. Next section starts with an integer ``nPath'' (0<`nPath'<20)indicating number of paths that connects two stations. Next `nPath' contains ``station1 station2 distance'', describing `station1' has a path to `station2' with distance equal to `distance' in kilometer and vice versa. Each kilometer costs an oil consumption of 2 taka (unit of money in Bangladesh). The third section consists of a integer ``nQuery'' (0<`nQuery'<10)with `nQuery' line of input. Each line have a query to follow in the format ``station1 station2 passenger'', asking to find the best path from station1 to station2 and what will be the cost for each passenger for a bus with `passenger' amount of seat. It is guaranteed that each map description is valid, and the query has a valid and unique path.

The Output

For each map print ``Map #X'', where `X' is the map number starting from 1. Then for each query print ``Query #Y'', where `Y' is the query number for each map starting from 1. Then for each query print the suitable path followed by the fare each passenger have to bear (rounded to the second digit after the decimal point) as shown below.

Sample Input

2

4
mirpur12 5
farmgate 8
gulistan 10
newmarket 5
4
mirpur12 farmgate 12
mirpur12 newmarket 20
farmgate gulistan 10
newmarket gulistan 8
2
mirpur12 gulistan 30
mirpur12 newmarket 30

3
uttara 2
farmgate 8
gulistan 10
2
uttara farmgate 35
farmgate gulistan 10
1
uttara gulistan 30

Sample Output

Map #1
Query #1
mirpur12 farmgate gulistan
Each passenger has to pay : 2.46 taka
Query #2
mirpur12 newmarket
Each passenger has to pay : 1.83 taka

Map #2
Query #1
uttara farmgate gulistan
Each passenger has to pay : 4.03 taka

Suman Mahbub
Created: 11-10-2002
Updated: 14-12-2002, 20-01-2003