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