Given x of unit A equals y of unit B, convert each listed amount to the other unit and print the result to six decimals.
Easy2MathImplementationNo attempts yetTime limit2sMemory limit512 MB"How do you say 'two kilos' in English?" Dudu asked that in 2015.
Dudu always has trouble with measurements and unit conversions. Do the conversions for him.
There are two units, A and B. An amount of x in unit A equals an amount of y in unit B. If A is kilograms and B is pounds, then x=3.25 and y=7.165024 is one example.
Use that relation to convert each given amount into the other unit.
The first line has two real numbers x and y, separated by a space. It means that x of unit A equals y of unit B.
The second line has the number of conversions N.
Each of the next N lines has an amount z and a unit q, separated by a space. q is the uppercase letter A or B. If q is A, convert z of unit A into unit B. If q is B, convert z of unit B into unit A.
Print N lines, one conversion result per line, in input order. Round each value to six decimal places and print exactly six digits after the decimal point. A result of zero is printed as 0.000000.