calc :: Double -> Double -> [Int] calc a b = [x, y, z] where l = b * logBase 10 a z = floor l r = 10 ** (l - fromIntegral z) x = floor r y = floor (r * 10) - x * 10 main :: IO () main = getLine >> getContents >>= putStr . unlines . map unwords . map (map show) . map (\(a : b : _) -> calc a b) . map (map read) . map words . lines