P8829 [Chuanzhi Cup #3 Practice Contest] Unit Conversion

Description

We know that computer storage size units include B, KB, MB, etc. Now please write a calculator to convert between storage size units. Note that $1$ GB = $2^{10}$ MB = $2^{20}$ KB = $2^{30}$ B.

Input Format

Input a string consisting of: an integer between 0 and 1023, a unit name (uppercase letters), an equals sign and a question mark, and a second unit name. The unit can only be one of `GB`, `MB`, `KB`, `B`.

Output Format

Output a number, accurate to 6 digits after the decimal point.

Explanation/Hint

Translated by ChatGPT 5