#P8829. Computer Storage Unit Conversion Calculator

    ID: 21993 Type: Default 1000ms 256MiB

Computer Storage Unit Conversion Calculator

Computer Storage Unit Conversion Calculator

You are given a value in a specific computer storage unit and you need to convert it into another unit. The supported units are B, KB, MB, and GB. The conversion is based on the formula: $$1\;GB = 2^{10}\;MB = 2^{20}\;KB = 2^{30}\;B.$$

For example, if you need to convert 1024 KB into MB, the answer is 1 because 1024 KB = 1 MB.

inputFormat

The input consists of a single line containing a number and two strings separated by spaces. The number represents the value to convert, the first string is the source unit, and the second string is the target unit. All units are one of: B, KB, MB, GB.

Example: 1024 KB MB

outputFormat

Output the converted value. If the result is an integer, output it without any decimal point.

sample

1024 KB MB
1