PSU Campuses#6937

PSU Campuses

1 secondo
64 megabyte
Molto facile

Prince of Songkla University or PSU has campuses in the South of Thailand. These campuses are Hatyai(H), Pattani(P), Suratthani(S), Phuket(K) and Trang(T). The distances between these campuses are shown in the table below.

When the President of PSU goes on mission in different campuses, he or she may want to know the total distance of the mission. The mission always starts from Hatyai campus and when the mission ends the president will always go back directly to Hatyai campus.

Given a list of campuses of a mission, your task is to write a program to calculate the total distance of the mission.

Input

The first line contains an integer (1 \leq n \leq 100) which determines the number of missions. The following lines contain a description of each mission. A mission is described by a string comprising only characters , , , and which refer to PSU campuses. The president visits the campuses in the order indicated in that string. Since Hatyai campus is always the starting point and also the end point of a mission, we will not mention at the beginning or the end of the string. However, can be an intermediate campus in a mission. A mission string may contain at most characters.

Output

For each mission (mission_i), print out in a line, "Case : " followed by the total distance (km), exactly as shown in the sample output.

Esempi

Esempio 1

Loading
Loading