Problem B
Imperial Measurement
The traditional imperial system has eight units of distance (excluding maritime units and some units used in surveying), related as follows:
thou (th) |
|
inch (in) |
1000 thous |
foot (ft) |
12 inches |
yard (yd) |
3 feet |
chain (ch) |
22 yards |
furlong (fur) |
10 chains |
mile (mi) |
8 furlongs |
league (lea) |
3 miles |
Given a distance measured in one of these units, can you figure out what it will be in another unit?
Input
The input consists of a single line of the form “$v$ $u$ in $\tilde{u}$”, where $1 \le v \le 100$ is an integer amount and $u$, $\tilde{u}$ are any of the units listed above, indicating that we are converting $v$ $u$’s into $\tilde{u}$’s. Units are given either by their full name or by their acronym, but will always be given in singular using only lower case letters.
Output
Output the distance converted into $\tilde{u}$. You do not need to worry about the precise formatting of the answer (e.g., number of decimals), but either the absolute error or the relative error of your output must be smaller than $10^{-9}$.
Sample Input 1 | Sample Output 1 |
---|---|
42 ft in inch |
504 |
Sample Input 2 | Sample Output 2 |
---|---|
10 furlong in lea |
0.4166666666667 |