Skip to content
UPEEC

Resistor Colour Code

Easy#engineering#electronics#strings· solved by 0 · time limit 2.0 s

A 4-band resistor's first three bands give two digits and a multiplier: black 0, brown 1, red 2, orange 3, yellow 4, green 5, blue 6, violet 7, grey 8, white 9. Value =(10d1+d2)×10m= (10 d_1 + d_2) \times 10^{m}.

Print the value as X ohms below 1000, Xk ohms from 1000 up to 999999, and XM ohms from 10610^6 — where X has no trailing zeros (e.g. 4.7k ohms, 22k ohms, 1M ohms).

Input

Three colour names (lowercase).

Output

The value.

Constraints

The multiplier band is between black and blue.

Sample 1

Input

red red brown

Output

220 ohms

Sample 2

Input

yellow violet red

Output

4.7k ohms

Sign in or join free to run and submit your solution.