Theatre Square in the capital city of Berland has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a × a.What is the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the Theatre Square, but the Square has to be covered. It's not allowed to break the flagstones. The sides of flagstones should be parallel to the sides of the Square.

The input contains three positive integer numbers in the first line: n,  m and a (1 ≤  n, m, a ≤ 109).

module Main where

import Control.Monad (sequence)
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  result <- (fmap (map fst)
             . sequence
             . map BS.readInteger
             . BS.words) `fmap` BS.getLine
  case result of
    Just (n : m : a : _)
      | flagstoneArea == 1 -> print area
      | flagstoneArea > area -> print 1
      | otherwise ->
        print ((ceiling ((fromIntegral n) / (fromIntegral a))) *
               (ceiling ((fromIntegral m) / (fromIntegral a))))
      where
        area = n * m
        flagstoneArea = a * a
    Nothing -> error ("err: invalid input " ++ show result)

module Main where

requiredCount :: Integer -> Integer -> Integer
requiredCount size tileSize = (size - 1) `div` tileSize + 1

solution :: Integer -> Integer -> Integer -> String
solution n m a = show $ (requiredCount n a) * (requiredCount m a)

main::IO()
main = do
    line <- getLine
    let [nString, mString, aString] = words line
    let n = read nString :: Integer
    let m = read mString :: Integer
    let a = read aString :: Integer
    putStr $ solution n m a

main = do
	contents <- getContents
	let
	   numbers = map (\str -> read str :: Int) $ words contents
	   n = numbers !! 0
	   m = numbers !! 1
	   k = numbers !! 2
	print $ (toInteger $ f n k) * (toInteger $ f m k)

f :: Int -> Int -> Int
f n k = if n `mod` k == 0
	then n `div` k
	else (n `div` k) + 1

{-# LANGUAGE CPP, TemplateHaskell #-}
-----------------------------------------------------------------------------
--
-- Module      :  Main
-- Copyright   :
-- License     :  AllRightsReserved
--
-- Maintainer  :
-- Stability   :
-- Portability :
--
-- |
--
-----------------------------------------------------------------------------

module Main (
    main
) where

import Control.Monad (unless)
import Data.List (stripPrefix)
import System.Exit (exitFailure)
--import Test.QuickCheck.All (quickCheckAll)

-- Simple function to create a hello message.
hello s = "Hello " ++ s

fun n a = ((div n a) + if mod n a >0 then 1 else 0)

count n m a =  (fun n a )* (fun m a)

-- Hello World
main = do
      [n, m, a] <- (map read . words) `fmap` getLine
      print ( count n m a)

-- Entry point for unit tests.
--testMain = do
--    allPass <- $quickCheckAll -- Run QuickCheck on all prop_ functions
--    unless allPass exitFailure

-- This is a clunky, but portable, way to use the same Main module file
-- for both an application and for unit tests.
-- MAIN_FUNCTION is preprocessor macro set to exeMain or testMain.
-- That way we can use the same file for both an application and for tests.
#ifndef MAIN_FUNCTION
#define MAIN_FUNCTION exeMain
#endif
--main = MAIN_FUNCTION

import Data.Word

solve:: (Integral a) => a -> a -> a -> a
solve n m a = (ceilDiv n a) * (ceilDiv m a)
    where
        ceilDiv = \x y -> (div x y) + (if (mod x y) > 0 then 1 else 0)

main :: IO ()
main = do
    --let input = "1000000000 1000000000 192"
    input <- getLine :: IO String
    let [n, m, a] = map (read :: String -> Word64) $ words input
    print $ solve n m a

import Data.Int
import Control.Applicative

findFlagstoneNumber :: Int64 -> Int64 -> Int64 -> Int64
findFlagstoneNumber n m a
  = foldl1 (*) $ solve1D <$> [n, m]
    where solve1D = (`div` a) . (+) (a - 1)

main :: IO ()
main = do
  [n, m, a] <- map read <$> words <$> getLine
  print $ findFlagstoneNumber n m a

import Data.List

solve :: [Integer] -> Integer
solve [n, m, a] = (div (n + a - 1)  a) * (div (m + a - 1) a)

--splitTokens :: String -> [String]
--splitTokens "" = []
--splitTokens (x:xs) = getTokens (x:xs) ""
--                    where getTokens "" s = [s]
--                          getTokens (y:ys) s = if y == ' ' the
main = do
    z <- getLine
    putStrLn $ show $ solve $ map read (words z)

divUp a b = (a - 1) `div` b + 1
solve [n, m, a] = (n `divUp` a) * (m `divUp` a)
main = interact $ show . solve . map read . words

main :: IO ()
main = interact func

func :: String -> String
func s = show . func' . map read $ words s

func' :: [Integer] -> Integer
func' (n:m:a:[]) = (m `div` a + (m `dived` a)) * (n `div` a + (n `dived` a))
  where dived x y = if x `mod` y == 0 then 0 else 1

плиты :: [Integer] -> Integer
плиты (ш:д:пл:[]) = (ceiling (fromInteger ш / fromInteger пл)) * (ceiling (fromInteger д / fromInteger пл))
main = interact $ show . плиты . map read . words

import Data.Int
findFlagstoneNumber :: Int64 -> Int64 -> Int64 -> Int64
findFlagstoneNumber n m a
  = div (n + a - 1) a
    * div (m + a - 1) a

solve :: String -> String
solve str
  = ( show
      $ findFlagstoneNumber
        (read $ args !! 0)
        (read $ args !! 1)
        (read $ args !! 2)
    ) ++ "\n"
  where args = words str

main :: IO ()
main = interact solve

(|>) a b = b a

f n m a =
  ceiling ((fromIntegral n) / (fromIntegral a))
  * ceiling ((fromIntegral m) / (fromIntegral a))

main = do
  s <- getLine
  let a = s |> words |> map (read :: String -> Int)
  f (a !! 0) (a !! 1) (a !! 2) |> print

main :: IO ()
main = do
    s <- getLine
    putStrLn $ (coverSquare' . (map read) . words) s
    return ()

coverSquare' :: (Show a, Integral a) => [a] -> String
coverSquare' [n,m,a] = show $ coverSquare n m a
coverSquare' _       = "coverSquare': Invalid number of arguments."

coverSquare :: Integral a => a -> a -> a -> a
coverSquare n m a = (n `quot'` a) * (m `quot'` a)
  where
    c `quot'` d = (c `quot` d) + (if c `rem` d > 0 then 1 else 0)

#! /usr/bin/runhaskell
module Main where
import System.IO
main = do
  s <- getLine
  let rs = (map read (words s)) :: [Integer]
  let n = head rs
      m = head (tail rs)
      a = last rs
      in putStrLn $ show (ff n a * ff m a)

ff :: Integer -> Integer -> Integer
ff n a = if n `mod` a == 0 then n `div` a
         else n `div` a + 1

main :: IO ()
main = do
	--nmpStr <- readFile "input.txt"
	nmpStr <- getLine
	let n : m : p : [] = map (read :: String -> Integer) $ words nmpStr
	print ((if ((mod n p) /= 0) then (div n p + 1) else div n p) * (if ((mod m p) /= 0) then (div m p + 1) else div m p))
	return ()

import qualified Data.ByteString.Char8 as B
import Data.Maybe

getThreeIntsM = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

cover x a = toInteger $ x `div` a + (if x `rem` a == 0 then 0 else 1)

main = do
        [n, m, a] <- getThreeIntsM
        putStrLn . show $ (cover n a) * (cover m a)

--flagStones :: Fractional a => a -> a -> a -> a
flagStones n m a = (ceiling $ n / a) * (ceiling $ m / a)

main = do
 str <- getLine
 let [n, m, a] = map read . words $ str :: [Double]
 print $ flagStones n m a

squares n m a
    | n < a        = 1              * divma
    | mod n a == 0 = (div n a    )  * divma
    | mod n a /= 0 = (div n a + 1)  * divma
    where
      divma
        | m <  a  = 1
        | m >= a  = if mod m a == 0 then div m a else div m a + 1

main = do
  numbers <- getLine
  let n = read ((words numbers) !! 0) :: Integer
  let m = read ((words numbers) !! 1) :: Integer
  let a = read ((words numbers) !! 2) :: Integer
  print (squares n m a)

import Control.Applicative

main = do
  [n, m, a] <- (map read . words) <$> getLine
  print $ (div (n+a-1) a)*(div (m+a-1) a)

main :: IO ()
main = interact $ show . solve . (map read . words) . head . lines

solve :: [Integer] -> Integer
solve [n, m, a] = ((n - 1) `quot` a + 1) * ((m - 1) `quot` a + 1)
solve _ = 0

import Data.Int
findFlagstoneNumber :: [Int64] -> Int64
findFlagstoneNumber args
  | [n, m, a] <- args
  = div (n + a - 1) a
    * div (m + a - 1) a

solve :: String -> String
solve str
  = (show $ findFlagstoneNumber $ map (\x -> read x) $ words str)
    ++ "\n"

main :: IO ()
main = interact solve

module Main (
  main
) where

import Data.Int

solve :: Int64 -> Int64 -> Int64 -> Int64
solve n m a = (n `div1` a) * (m `div1` a)
  where
    div1 x y = (x + y - 1) `quot` y

main :: IO ()
main = do
  [n, m, a] <- getInts
  print $ solve n m a

getInts :: IO [Int64]
getInts = (map read . words) `fmap` getLine :: IO [Int64]

main = do
    [n,m,a] <- fmap (map read . words) $ getLine :: IO [Integer]
    print $ (floor n a) * (floor m a)
    where floor x y = (x + y - 1) `div` y

import Control.Monad

main :: IO ()
main = do
    line <- getLine
    let n:m:a:xs = fmap (\x -> read x :: Int) $ words line
    print (toInteger (coveringStones n a) * toInteger (coveringStones m a))

coveringStones :: Int -> Int -> Int
coveringStones l a =(div l a) + if (mod l a == 0) then 0 else 1

ans :: [Integer] -> Integer
ans (x : (y : (z : xs))) = ((x + z - 1) `div` z) * ((y + z - 1) `div` z)

main = do
    d <- getLine
    putStr (show (ans (map read (words d))))

--ghc 7.10

import Control.Applicative
import Control.Monad
import System.IO

readNumbers :: String -> [Integer]
readNumbers = map read . words

res n a = if (mod n a == 0) then div n a else 1 + div n a

-- IO Monad
main :: IO ()
main = do
    l1 <- getLine
    let aye = readNumbers l1
        n = aye!!0
        m = aye!!1
        a = aye!!2
    print(res n a * res m a)

module Main where

import Control.Monad
import Data.List

getUpperBound :: Integer -> Integer -> Integer
getUpperBound x y
    | mod x y == 0 = quot x y
    | otherwise    = (quot x y) + 1

theaterSquare :: [Integer] -> Integer
theaterSquare (x:y:z:_) = (getUpperBound x z) * (getUpperBound y z)

main :: IO()
main = do
    input <- getLine
    let arr = Data.List.map (read :: String -> Integer) . words $ input
    print . theaterSquare $ arr

readInts :: IO [Integer]
readInts = fmap (map read.words) getLine

main = do
    [n, m, a] <- readInts
    putStrLn $ (show (((n + a - 1) `div` a) * ((m + a - 1) `div` a)))

module Main where
main = interact $ match . fmap read . words

match [n, m, a] = show $ solve n m a
match _ = error "Input mismatch"

--solve :: Integer -> Integer -> Integer -> Integer
solve :: (Integral a) => a -> a -> a -> a
solve n m a = divUp n a * divUp m a

divUp :: (Integral a) => a -> a -> a
divUp a b =  (a + b - 1) `div` b

import GHC.Int

convert :: Read a => String -> [a]
convert = map read . words

main :: IO ()
main = do
  line <- getLine
  let [n, m, a] = convert line :: [GHC.Int.Int64]
  let x = (n - 1) `div` a + 1
  let y = (m - 1) `div` a + 1
  print (x * y)

solve' :: [Integer] -> Integer
solve' [n, m, a] = ((n - 1) `quot` a + 1) * ((m - 1) `quot` a + 1)

solve :: IO String -> IO Integer
solve x = fmap (solve'.(map read.words)) x

main :: IO()
main = solve getLine >>= print

module Main where

import Control.Applicative ((<$>), pure)
import Data.Word (Word64)

input :: IO (Word64, Word64, Word64)
input = do
  [n, m, a] <- fmap read . words <$> getLine
  pure (n, m, a)

count :: Word64 -> Word64 -> Word64
count x y =
  let n = x `div` y
      in if x `mod` y /= 0
         then n + 1
         else n

main :: IO ()
main = do
  (n, m, a) <- input
  print $ count n a * count m a

calcStones :: [Integer] -> Integer
calcStones [x, y, z] = row * column
  where
    row = ceiling $ (fromInteger x) / (fromInteger z)
    column = ceiling $ (fromInteger y) / (fromInteger z)

main = do
  inputList <- getLine >>= return . words
  print $ calcStones $ map (\x -> read x :: Integer) inputList

main=interact(unlines.map  f.lines)
f s=do show(ceiling(n/a)*ceiling(m/a))
    where [n, m, a]=(map read (words s))

import Control.Applicative

main = do
  [n, m, a] <- (map read . words) <$> getLine
  print $ (div (n+a-1) a) *(div (m+a-1) a)

import Control.Applicative
main= do
	[n,m,a]<- map read. words <$> getLine:: IO [Integer]
	let x = ( div n a) + if ( mod n a ==0) then 0 else 1
	let y = ( div m a) + if ( mod m a ==0) then 0 else 1
	print $ x*y

main= readsoveprint
readsoveprint::IO()
readsoveprint=getLine >>= print . solve .isdata
solve :: [Int]->Integer
solve [x,y,z]=(ceiling $ fromIntegral x/ fromIntegral z) *  (ceiling $ fromIntegral y/ fromIntegral z)
isdata :: String->[Int]
isdata x= map read  $ words x

module Main where

parseInts :: String -> [Integer]
parseInts = map (read :: String -> Integer) . words

divUp n a = (div n a) +
    if (mod n a) > 0
       then 1
       else 0

main = do
    answer <- getLine
    let [n, m, a] = parseInts answer
    print $ (divUp n a) * (divUp m a)
    return ()

main :: IO ()
main = interact func

func :: String -> String
func s = show . func' . map read $ words s

func' :: [Integer] -> Integer
func' (n:m:a:[]) = (m `div` a + (m `dived` a)) * (n `div` a + (n `dived` a))
  where dived x y = if x `mod` y == 0 then 0 else 1
func' _ = error ""

a meiapal resto
    | null resto = (meiapal, resto)
    | otherwise = (\(r:rs)->if r==' ' then (meiapal, rs) else a (meiapal++[r]) rs) resto

pri resu rest
    | null rest = (resu, rest)
    | otherwise = (\(pal, resto)->pri (resu++[pal]) resto) (a [] rest)

separa str = fst (pri [] str)

sq n m a
    | a==1 = m*n
    | (mod n a) == 0 = sq (n-1) m a
    | (mod m a) == 0 = sq n (m-1) a
    | otherwise = ((div m a)+1)*((div n a)+1)

sqn l = let a:b:c:_=l in sq a b c

main = do
    s <- getLine
    putStrLn (show(sqn (let readInt a = read a::Integer in map readInt (separa s))))

import Data.Int
import Control.Applicative

findFlagstoneNumber :: Int64 -> Int64 -> Int64 -> Int64
findFlagstoneNumber n m a
  = solve1d n * solve1d m
  where solve1d x = div (x + a - 1) a

solve :: String -> String
solve str
  | [n, m , a] <- read <$> words str
  = show $ findFlagstoneNumber n m a

main :: IO ()
main = interact solve

module Main (main) where

import System
import Data.Char
import Data.List
import Control.Monad
import Control.Applicative

solve n m a = ((n-1) `div` a + 1)*((m-1) `div` a + 1)

main = do line <- getLine
          let arr = words line
          let [n,m,a] = map read arr :: [Integer]
          print $ solve n m a
          return ()

main = do
    [n,m,a] <- fmap (map read . words) $ getLine :: IO [Integer]
    print $ (floor n a) * (floor m a)
    where floor x y = (x + y - 1) `div` y

import Data.Int
findFlagstoneNumber :: [Int64] -> Int64
findFlagstoneNumber args
  | [n, m, a] <- args
  = div (n + a - 1) a
    * div (m + a - 1) a

solve :: String -> String
solve str
  = (show $ findFlagstoneNumber $ map (\x -> read x) $ words str)
    ++ "\n"

main :: IO ()
main = interact solve

import Data.Int
findFlagstoneNumber :: Int64 -> Int64 -> Int64 -> Int64
findFlagstoneNumber n m a
  = div (n + a - 1) a * div (m + a - 1) a

solve :: String -> String
solve str
  | [n, m, a] <- map (\x -> read x) $ words str
  = show $ findFlagstoneNumber n m a

main :: IO ()
main = interact solve

main = fmap (fmap read . words) getLine >>= \[n,m,a] -> print $ (n^/a)*(m^/a) where x^/y = quot (x + y - 1) y

f :: [String] -> [Integer]
f = map read

--tileCount:: (Integral a) => a -> a-> a
tileCount length side
    | modulus == 0 = quotient
    | otherwise = quotient + 1
    where
        modulus = length `mod` side
        quotient = length `div` side

main = do
    z <- getLine
    let [m, n, a] = f (words z)
    print ((tileCount m a) * (tileCount n a))

str2int_list :: String -> [Int]
str2int_list = map read . words

stonesNeeded x a =
    let quotient = div x a
        has_remainder = fromEnum (mod x a /= 0)
    in quotient + has_remainder

main = do
    input <- getLine :: IO String
    let [n, m, a] = str2int_list input
        stonesNeededBy x = stonesNeeded x a
        answer = (toInteger $ stonesNeededBy n) * (toInteger $ stonesNeededBy m)
    print answer

плиты :: [Integer] -> Integer
плиты (ш:д:пл:[]) = (ceiling (fromInteger ш / fromInteger пл)) * (ceiling (fromInteger д / fromInteger пл))
main = interact $ show . плиты . map read . words

import Data.Int
import Control.Applicative

findFlagstoneNumber :: Int64 -> Int64 -> Int64 -> Int64
findFlagstoneNumber n m a
  = solve1d n * solve1d m
  where solve1d x = div (x + a - 1) a

solve :: String -> String
solve str
  | [n, m, a] <- read <$> words str
  = show $ findFlagstoneNumber n m a

main :: IO ()
main = interact solve

main = do
    (n:m:[a]) <- map read <$> words <$> getLine
    print $ (n `divUp` a) * (m `divUp` a) where
        divUp a b = ceiling (fromIntegral a / fromIntegral b)

main=interact(unlines.map f.lines)
f s=do show$ceiling(n/a)*ceiling(m/a)
 where [n,m,a]=map read(words s)

module Main (
  main
) where

import Data.Int

solve :: Int64 -> Int64 -> Int64 -> Int64
solve n m a = (n `div1` a) * (m `div1` a)
  where
    div1 x y = (x + y - 1) `quot` y

main :: IO ()
main = do
  [n, m, a] <- getInts
  print $ solve n m a

getInts :: IO [Int64]
getInts = (map read . words) `fmap` getLine :: IO [Int64]

getDiv :: Integer -> Integer -> Integer
getDiv x a = x `div` a

getMul :: Integer -> Integer -> Integer
getMul x a
 | x `mod` a == 0 = getDiv x a
 | otherwise = getDiv x a + 1

main :: IO ()
main = do
 num <- fmap (map read.words) getLine
 let a = last num
 print $ getMul (num !! 0) a * getMul (num !! 1) a

main = do
  line <- getLine
  let [m, n, a] = map read (words line) :: [Integer]
  print $ div (m+a-1) a * div (n+a-1) a

{-# LANGUAGE OverloadedStrings, ScopedTypeVariables, BangPatterns, PatternGuards, ViewPatterns, RecordWildCards, ForeignFunctionInterface, CPP, TypeSynonymInstances, FlexibleInstances, FlexibleContexts, ImplicitParams #-}
{-# OPTIONS_GHC -O2 -Wall -fno-warn-unused-do-bind -fno-warn-type-defaults -fno-warn-unused-imports #-}

import Control.Applicative
import Control.Monad
import Foreign
import Foreign.C
import Data.List
import qualified Data.ByteString.Char8 as BS
-- import qualified Data.Map as Map
-- import qualified Data.Set as Set

main :: IO ()
main = do
  n   :: Integer        <- input
  m   :: Integer        <- input
  a   :: Integer        <- input
  output' $ ((n - 1) `quot` a + 1) * ((m - 1) `quot` a + 1)

--------------------------------------------------
-- Imported C functions
--------------------------------------------------
#define BUFMAX                (100005)

type BString = BS.ByteString

foreign import ccall unsafe "stdio.h scanf"
  c_scanf_i     :: CString -> Ptr Int   -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_i64   :: CString -> Ptr Int64 -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_f     :: CString -> Ptr Float -> IO ()
foreign import ccall unsafe "stdio.h scanf"
  c_scanf_s     :: CString -> CString   -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_i    :: CString -> Int       -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_i64  :: CString -> Int64     -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_d    :: CString -> Double    -> IO ()
foreign import ccall unsafe "stdio.h printf"
  c_printf_s    :: CString -> CString   -> IO ()

fmt_i, fmt_i64, fmt_f, fmt_d, fmt_s :: CString
fmt_i   = unsafePerformIO $ newCString "%d"
fmt_i64 = unsafePerformIO $ newCString "%I64d"
fmt_f   = unsafePerformIO $ newCString "%f"
fmt_d   = unsafePerformIO $ newCString "%.16f"
fmt_s   = unsafePerformIO $ newCString "%s"
{-# NOINLINE fmt_i    #-}
{-# NOINLINE fmt_i64  #-}
{-# NOINLINE fmt_f    #-}
{-# NOINLINE fmt_d    #-}
{-# NOINLINE fmt_s    #-}

ptr_i   :: Ptr Int
ptr_i   = unsafePerformIO malloc
ptr_i64 :: Ptr Int64
ptr_i64 = unsafePerformIO malloc
ptr_f   :: Ptr Float
ptr_f   = unsafePerformIO malloc
ptr_d   :: Ptr Double
ptr_d   = unsafePerformIO malloc
ptr_s   :: CString
ptr_s   = unsafePerformIO $ mallocArray BUFMAX
{-# NOINLINE ptr_i    #-}
{-# NOINLINE ptr_i64  #-}
{-# NOINLINE ptr_f    #-}
{-# NOINLINE ptr_d    #-}
{-# NOINLINE ptr_s    #-}

class Input a           where
  input :: IO a

instance Input Int      where
  input = c_scanf_i fmt_i ptr_i >> peek ptr_i
instance Input Int64    where
  input = c_scanf_i64 fmt_i64 ptr_i64 >> peek ptr_i64
instance Input Integer  where
  input = toInteger <$> (input :: IO Int64)
instance Input Double   where
  input = c_scanf_f fmt_f ptr_f >> realToFrac <$> peek ptr_f
instance Input String   where
  input = c_scanf_s fmt_s ptr_s >> peekCString ptr_s
instance Input BString  where
  input = c_scanf_s fmt_s ptr_s >> BS.packCString ptr_s

class Output a          where
  output_   :: a -> IO ()
  output    :: a -> IO ()
  output    = (>> space  ) . output_
  output'   :: a -> IO ()
  output'   = (>> newline) . output_

instance Output Int     where
  output_   = c_printf_i fmt_i
instance Output Int64   where
  output_   = c_printf_i64 fmt_i64
instance Output Integer where
  output_   = output_ . show
instance Output Double  where
  output_   = c_printf_d fmt_d
instance Output String  where
  output_   = flip withCString (c_printf_s fmt_s)
instance Output BString where
  output_   = flip BS.useAsCString (c_printf_s fmt_s)

space   :: IO ()
space   = output_ (" "  :: String)

newline :: IO ()
newline = output_ ("\n" :: String)

--import System.Environment
import Data.Int

solve n m a =
  hline * vline
  where
    hadd = if n `mod` a > 0 then 1 else 0
    vadd = if m `mod` a > 0 then 1 else 0
    hline = n `div` a + hadd
    vline = m `div` a + vadd

readInts :: IO [Int64]
readInts = fmap (map read.words) getLine

main = do
  (n:m:a:rest) <- readInts
  putStrLn (show $ solve n m a)

main :: IO ()
main = interact func

func :: String -> String
func s = show . func' . map read $ words s

func' :: [Integer]  ->   Integer
func' (n:m:a:[]) = (m `div` a + (m `dived` a)) * (n `div` a + (n `dived` a))
  where dived x y = if x `mod` y == 0 then 0 else 1
func' _ = error ""

-- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-- File Name : 0001A.hs
-- Creation Date : 17-10-2012
-- Last Modified : Fri 19 Oct 2012 01:44:16 PM EEST
-- Created By : Greg Liras <gregliras@gmail.com>
--_._._._._._._._._._._._._._._._._._._._._.

{-# OPTIONS_GHC -O2 -optc-O2 #-}

import Data.Char (isSpace)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

calcTiles len side =
    let
        x = ceiling $ fromIntegral len / fromIntegral side
    in
        case x of
            0 -> 1
            _ -> x

main :: IO ()
main =
    do
        all <- BS.getContents
        let Just (n, r1)    = readInt all
        let Just (m, r2)    = readInt r1
        let Just (a, _)     = readInt r2
        let x = fromIntegral $ (calcTiles n a) * (calcTiles m a)
        print $ x
    where
        readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readInteger s = BSC.readInteger (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
            Just (x, r) ->  let
                                (xs, t) = readMany readf r
                            in
                                (x : xs, t)
            Nothing     ->  ([], s)

module Main where

main :: IO ()
main = do
        line <- getLine
        let i = map (read :: String->Int) $ words line
        let n = fromIntegral $ i !! 0
        let m = fromIntegral $ i !! 1
        let a = fromIntegral $ i !! 2
        print $ (ceiling $ m / a) * (ceiling $ n / a)

import Data.Int

parseString :: String -> [Int64]
parseString str = map (\x -> read x::Int64) $ words str

solution :: Int64 -> Int64 -> Int64 -> Int64
solution n m a = (fst x1 + y x1) * (fst x2 + y x2)
    where
        x1 = divMod n a
        x2 = divMod m a
        y x = if snd x == 0 then 0 else 1

main :: IO()
main = do
    a <- getLine
    print $ solution ((ps a)!!0) ((ps a)!!1) ((ps a)!!2)
    where ps = parseString

import Control.Monad

main :: IO ()
main = do
    line <- getLine
    let n:m:a:xs = fmap (\x -> read x :: Int) $ words line
    print (toInteger (coveringStones n a) * toInteger (coveringStones m a))

coveringStones :: Int -> Int -> Int
coveringStones l a =(div l a) + if (mod l a == 0) then 0 else 1

import Data.Int
findFlagstoneNumber :: Int64 -> Int64 -> Int64 -> Int64
findFlagstoneNumber n m a
  = div (n + a - 1) a * div (m + a - 1) a

solve :: String -> String
solve str
  | [n, m, a] <- map (\x -> read x) $ words str
  = show $ findFlagstoneNumber n m a

main :: IO ()
main = interact solve

s[n,m,a]=div (-n) a *  div (-m) a
main=getLine>>=print.s.map read.words

f :: [String] -> [Integer]
f = map read

--tileCount:: (Integral a) => a -> a-> a
tileCount length side
    | modulus == 0 = quotient
    | otherwise = quotient + 1
    where
        modulus = length `mod` side
        quotient = length `div` side

main = do
    z <- getLine
    let [m, n, a] = f (words z)
    print ((tileCount m a) * (tileCount n a))

{-# LANGUAGE ScopedTypeVariables #-}

import Data.List.Split

main :: IO()
main = do
  line :: String <- getLine
  let x = map read $ splitOn " " line :: [Integer]
  let f = \[a,b,c] -> ((-a) `div` c) * ((-b) `div` c)
  print (f x)

{-# OPTIONS_GHC -O2 #-}

main :: IO ()
main = do
  n : m : a : _ <- fmap (map read . words) getLine :: IO [Integer]
  print $ ((n - 1) `quot` a + 1) * ((m - 1) `quot` a + 1)

ans :: Integer -> Integer  -> Integer  -> Integer
ans n m a = x * y
 where x = if n `mod` a == 0 then n `div` a else (n `div` a) + 1
       y = if m `mod` a == 0 then m `div` a else (m `div` a) + 1

main = do
	inp <- getLine
	let (n : m : a : []) = map read (words inp) :: [Integer]
	putStrLn $ show $ ans n m a

module Main where

import           Control.Applicative

f :: Double -> Double -> Double -> Integer
f n m a = g n * g m
  where
    g x = ceiling $ (/) x a

main :: IO ()
main = do
  (n:m:a:_) <- words <$> getLine
  putStrLn $ show $ f (read n) (read m) (read a)

import qualified Data.ByteString.Char8 as B
import Data.Maybe

getThreeIntsM = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

cover x a = toInteger $ x `div` a + (if x `rem` a == 0 then 0 else 1)

main = do
        [n, m, a] <- getThreeIntsM
        putStrLn . show $ (cover n a) * (cover m a)

main :: IO ()
main = do
    [n, m, a] <- fmap (map read . words) getLine :: IO [Integer]
    let rp = if mod n a /= 0 then 1 else 0
        rq = if mod m a /= 0 then 1 else 0
        p = (div n a) + rp
        q = (div m a) + rq
    print (p * q)

ceildiv m n = m `div` n + if m `mod` n == 0 then 0 else 1

main = do
  line <- getLine
  let [m, n, a] = map read (words line) :: [Integer]
  putStrLn . show $ ceildiv m a * ceildiv n a

main = do
   input <- fmap words getLine
   let ints = (map read input :: [Integer])
   let a = ints !! 0
   let b = ints !! 1
   let c = ints !! 2
   print (calc a b c)

calc a b c = (if mod a c == 0 then div a c else div a c + 1)*(if mod b c == 0 then div b c else div b c + 1)

main = do
    [n,m,a] <- fmap (map read . words) $ getLine :: IO [Integer]
    print $ (floor n a) * (floor m a)
    where floor x y = (x + y - 1) `div` y

module Main where

import Data.Int (Int64)

main :: IO ()
main = mapM_ (print . (\[m, n, a] -> f m n a) . map read . words) . lines =<< getContents

f :: Int64 -> Int64 -> Int64 -> Int64
f n m a = ceiling (fromIntegral n / fromIntegral a) * ceiling (fromIntegral m / fromIntegral a)

module Main where

main :: IO ()
main = do
        line <- getLine
        let i = map (read :: String->Int) $ words line
        let n = fromIntegral $ i !! 0
        let m = fromIntegral $ i !! 1
        let a = fromIntegral $ i !! 2
        print $ (ceiling $ m / a) * (ceiling $ n / a)

main = do
  [a, b, c] <- (read <$>) <$> words <$> getLine
  print $ div (a + c - 1) c * div (b + c - 1) c

squares n m a
    | mod n a == 0 = (div n a    )  * divma
    | mod n a /= 0 = (div n a + 1)  * divma
    where
      divma = if div m a <= 0 then 1 else div m a + 1

main = do
  numbers <- getLine
  let n = read ((words numbers) !! 0) :: Int
  let m = read ((words numbers) !! 1) :: Int
  let a = read ((words numbers) !! 2) :: Int
  print (squares n m a)

main :: IO ()
main = do
	--nmpStr <- readFile "input.txt"
	nmpStr <- getLine
	let n : m : p : [] = map (read :: String -> Int) $ words nmpStr
	print ((if ((mod n p) /= 0) then (div n p + 1) else div n p) * (if ((mod m p) /= 0) then (div m p + 1) else div m p))
	return ()

import System.Environment(getArgs)

p1a :: Double -> Double -> Double -> Int
p1a n m a = ceiling (n / a) * ceiling (m / a)

main :: IO ()
main = do cons <- getContents
          let [n, m, a] = fmap read $ words cons
          print $ p1a n m a

module Main where

import IO
import GHC.Base

main = do

    s <- getLine
    (m:n:a) <- return $ map readint $ split s ' '
    --m1 <- getLine
    --n1 <- getLine
    --a1 <- getLine

    print $ ( (m `roundInt` head a) * (n `roundInt` head a))
roundInt :: Int -> Int -> Int
roundInt a b | a `modInt` b == 0 = a `divInt` b
             | otherwise = a`divInt`b + 1
--readseq :: String -> [Int]
--readseq = read
split :: String -> Char -> [String]
split [] delim = [""]
split (c:cs) delim
   | c == delim = "" : rest
   | otherwise = (c : head rest) : tail rest
   where
       rest = split cs delim
readint :: String -> Int
readint = read

main = do
    [n,m,a] <- fmap (map read . words) $ getLine :: IO [Int]
    print $ (floor n a) * (floor m a)
    where floor x y = (x + y - 1) `div` y

import Control.Applicative

tileCount:: (Integral a) => a -> a-> a
tileCount length side
    | modulus == 0 = quotient
    | otherwise = quotient + 1
    where
        modulus = length `mod` side
        quotient = length `div` side

readInt :: String -> Int
readInt = read

main = do
    [m, n, a] <- (map readInt . words) <$> getLine
    print ((tileCount m a) * (tileCount n a))

--import Helpers
--import Data.String.Utils

{-
indicate :: String -> String
indicate address =
    if address == "127.0.0.1" then "localhost" else address
-}
{-
indicate :: String -> String
indicate "127.0.0.1" = "localhost"
indicate address = address
-}
parseInt :: String -> Int
parseInt x = read x :: Int

solve:: Int -> Int -> Int -> Int
solve n m a = (ceilDiv n a) * (ceilDiv m a)

ceilDiv :: Int -> Int -> Int
ceilDiv x y = (div x y) + (if (mod x y) > 0 then 1 else 0)

main :: IO ()
main = do
    --let input = "6 6 4"
    input <- getLine :: IO String
    let parsed = map parseInt $ words input
    --print parsed
    print $ solve (head parsed) (head $ tail parsed) (head $ tail $ tail parsed)

f :: [String] -> [Int]
f = map read

tileCount:: (Integral a) => a -> a-> a
tileCount length side
    | modulus == 0 = quotient
    | otherwise = quotient + 1
    where
        modulus = length `mod` side
        quotient = length `div` side

main = do
    z <- getLine
    let [m, n, a] = f (words z)
    print ((tileCount m a) * (tileCount n a))

import System.Environment

solve n m a =
  hline * vline
  where
    hadd = if n `mod` a > 0 then 1 else 0
    vadd = if m `mod` a > 0 then 1 else 0
    hline = n `div` a + hadd
    vline = m `div` a + vadd

readInts :: IO [Int]
readInts = fmap (map read.words) getLine

main = do
  (n:m:a:rest) <- readInts
  putStrLn (show $ solve n m a)

solve :: Int -> Int -> Int
solve x y = (x + y - 1) `div` y

main = do
  line <- getLine
  let [n, m, a] = map read $ words line
  print $ ((solve n a) * (solve m a))

module Main (
  main
) where

import Data.Maybe
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8

solve :: Int -> Int -> Int -> Int
solve n m a = (n `div1` a) * (m `div1` a)
  where
    div1 x y = (x `div` y) + if (x `mod` y) == 0 then 0 else 1

main :: IO ()
main = do
  [n, m, a] <- getInts
  print $ solve n m a

getInts :: IO [Int]
getInts = fmap (map readInt . BS8.words) BS.getLine
  where
    readInt =  fst . fromJust . BS8.readInt

import Control.Monad

main :: IO ()
main = do
    line <- getLine
    let n:m:a:xs = fmap (\x -> read x :: Int) $ words line
    print ((coveringStones n a) * (coveringStones m a))

coveringStones :: Int -> Int -> Int
coveringStones l a = (div l a) + if (mod l a == 0) then 0 else 1

(|>) a b = b a

f n m a =
  ceiling ((fromIntegral n) / (fromIntegral a))
  + ceiling ((fromIntegral m) / (fromIntegral a))

main = do
  s <- getLine
  let a = s |> words |> map (read :: String -> Int)
  f (a !! 0) (a !! 1) (a !! 2) |> print

main = do
	input <- getLine
	let n = read $ [input !! 0]
	let m = read $ [input !! 2]
	let a = read $ [input !! 4]
	putStrLn $ show $ (ceiling(n / a)) * (ceiling(m / a))

module Main where

main :: IO ()
main = do
  input <- getLine
  print $ (solve.words) input

solve :: [String] -> Int
solve input = let
  ints = map read input :: [Int]
  [n, m, a] = ints
  nAdd = if div n a == 0 then 0 else 1
  mAdd = if div m a == 0 then 0 else 1
  nPlit = div n a
  mPlit = div m a
  in
   (nPlit + nAdd) * (mPlit + mAdd)

solve :: Int -> Int -> Int -> Int
solve n m a = squares n a * squares m a
squares :: Int -> Int -> Int
squares x a
    | x `mod` a == 0 = x `div` a
    | otherwise = x `div` a + 1
main = do
    numsStr <- getLine
    let [n, m, a] = map read $ words numsStr
    print $ solve n m a

solve :: [Int] -> Int
solve [x, y, a] = (x' + x `quot` a)*(y' + y `quot` a)
  where x' = if x `rem` a == 0 then 0 else 1
        y' = if y `rem` a == 0 then 0 else 1

main = interact (show . solve . map read . words)

{-# LANGUAGE BangPatterns, ViewPatterns, PatternGuards, ScopedTypeVariables #-}
{-# LANGUAGE FlexibleInstances, FlexibleContexts, TypeSynonymInstances #-}
{-# LANGUAGE ForeignFunctionInterface #-}

import Control.Applicative
import Control.Monad
import Data.Int
import Foreign
import Foreign.C
import qualified System.IO.Unsafe as U

main :: IO ()
main = do
  [n, m, a]  :: [Int]   <- replicateM 3 input
  print $ ((n - 1) `quot` a + 1) * ((m - 1) `quot` a + 1)

--------------------------------------------------
-- Helper functions
--------------------------------------------------
for_ :: Int -> Int -> (Int -> IO ()) -> IO ()
for_ begin end k = loop begin
 where
  loop !i = when (i < end) $ k i >> loop (i + 1)

c_bufsize :: Int
c_bufsize = 2 ^ 16

{-# NOINLINE g_buffer #-}
g_buffer :: Ptr ()
g_buffer = U.unsafePerformIO $ mallocBytes c_bufsize

class Input a where
  input :: IO a

instance Input Int where
  input = do
    scan_i c_format_i g_buffer'
    peek g_buffer'
   where
    g_buffer' = castPtr g_buffer :: Ptr Int

foreign import ccall unsafe "stdio.h scanf" scan_i :: CString -> Ptr Int -> IO ()

{-# NOINLINE c_format_i #-}
c_format_i :: CString
c_format_i  = U.unsafePerformIO $ newCString "%d"

instance Input Int64 where
  input = do
    scan_i64 c_format_i64 g_buffer'
    peek g_buffer'
   where
    g_buffer' = castPtr g_buffer :: Ptr Int64

foreign import ccall unsafe "stdio.h scanf" scan_i64 :: CString -> Ptr Int64 -> IO ()

{-# NOINLINE c_format_i64 #-}
c_format_i64 :: CString
c_format_i64  = U.unsafePerformIO $ newCString "%I64d"

instance Input String where
  input = do
    scan_s c_format_s g_buffer'
    peekCString g_buffer'
   where
    g_buffer' = castPtr g_buffer :: CString

foreign import ccall unsafe "stdio.h scanf" scan_s :: CString -> CString -> IO ()

{-# NOINLINE c_format_s #-}
c_format_s :: CString
c_format_s  = U.unsafePerformIO $ newCString "%s"

module Main where
main = do
       inpStr <- getLine
       let [n, m, a] = readIntList inpStr
       print $ solve n m a

readIntList :: String -> [Int]
readIntList = fmap read . words

solve :: Int -> Int -> Int -> Int
solve n m a = (divUp n  a) *  (divUp m a)

divUp :: (Integral i) => i -> i -> i
divUp a b =  (a + b - 1) `div` b

main = putStrLn . show . (\[a,b,c]->((a+c-1) `div` c) * ((b+c - 1 :: Int) `div` c)) . map read . words =<< getLine

module Main where

compute :: Int -> Int -> Int -> Int
compute n m a = ceiling (toRational n / toRational a) * ceiling (toRational m / toRational a)

main :: IO ()
main = do
	input <- getLine
	let tokens = words input;
		n = read (tokens !! 0);
		m = read (tokens !! 1);
		a = read (tokens !! 2) in
		putStrLn (show (compute n m a))

--BEGIN--
mod' :: Int -> Int -> Int
mod' x y | (y > x)   = x
         | otherwise = mod' (x - y) y

_div' :: Int -> Int -> Int -> Int
_div' x y k | (y > x)   = k
            | otherwise = _div' (x - y) y (k + 1)

div' :: Int -> Int -> Int
div' x y = _div' x y 0

main :: IO ()
main = do
--  nmaStr <- readFile "input.txt"
    nmaStr <- getLine
    let n : m : a : [] = map (read :: String -> Int) $ words nmaStr

    let x = div' n a
    let y = div' m a

    let x' = if ((mod' n a) /= 0) then (x + 1) else x
    let y' = if ((mod' m a) /= 0) then (y + 1) else y

    print (x' * y')

    return ()
--END--

module Main where

import Control.Monad (sequence)
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  result <- (fmap (map fst)
             . sequence
             . map BS.readInt
             . BS.words) `fmap` BS.getLine
  case result of
    Just (n : m : a : _)
      | flagstoneArea == 1 -> print area
      | flagstoneArea > area -> print 1
      | otherwise -> print ((area `div` flagstoneArea) ^ 2)
      where
        area = n * m
        flagstoneArea = a * a
    Nothing -> error ("err: invalid input " ++ show result)

f[n,m,a] = (-n `div` a) * (-m `div` a)
main = interact $ show.f.map read.words

import Control.Monad

fn a x n
    | a * x > n = a
    | otherwise = fn (a+1) x n

main = do
    l <- liftM words getLine
    let [n,m,a] = map read l :: [Int]
    -- print (n,m,a)

    let w = fn 1 4 n
    let h = fn 1 4 m
    -- print (w,h)
    print (w*h)

squares n m a
    | mod n a == 0 = (div n a    )  * divma
    | mod m a /= 0 = (div n a + 1)  * divma
    where
      divma = if div m a == 0 then 1 else div m a + 1

main = do
  numbers <- getLine
  let n = read ((words numbers) !! 0) :: Int
  let m = read ((words numbers) !! 1) :: Int
  let a = read ((words numbers) !! 2) :: Int
  print (squares n m a)

module Main (
  main
) where

import Data.Maybe
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BS8

solve :: Int -> Int -> Int -> Int
solve n m a = (n `div1` a) * (m `div1` a)
  where
    div1 x y = (x + y - 1) `quot` y

main :: IO ()
main = do
  [n, m, a] <- getInts
  print $ solve n m a

getInts :: IO [Int]
getInts = fmap (map readInt . BS8.words) BS.getLine
  where
    readInt =  fst . fromJust . BS8.readInt

a meiapal resto
    | null resto = (meiapal, resto)
    | otherwise = (\(r:rs)->if r==' ' then (meiapal, rs) else a (meiapal++[r]) rs) resto

pri resu rest
    | null rest = (resu, rest)
    | otherwise = (\(pal, resto)->pri (resu++[pal]) resto) (a [] rest)

separa str = fst (pri [] str)

sq n m a
    | a==1 = m*n
    | (mod n a) == 0 = sq (n-1) m a
    | (mod m a) == 0 = sq n (m-1) a
    | otherwise = ((div m a)+1)*((div n a)+1)

sqn l = let a:b:c:_=l in sq a b c

main = do
    s <- getLine
    putStrLn (show(sqn (let readInt a = read a::Int in map readInt (separa s))))

{-# LANGUAGE ScopedTypeVariables #-}

import Data.List.Split

main :: IO()
main = do
  line :: String <- getLine
  let x = map read $ splitOn " " line :: [Int]
  print $ (((x !! 0) + (x !! 2) - 1) `quot` (x !! 2) *
      ((x !! 1) + (x !! 2) - 1) `quot` (x !! 2))

import Control.Applicative
main= do
	[n,m,a]<- map read. words <$> getLine:: IO [Int]
	let x = ( div n a) + if ( mod n a ==0) then 0 else 1
	let y = ( div m a) + if ( mod m a ==0) then 0 else 1
	print $ x*y

solve [ n, m, a ] = ( n `div` a ) * ( m `div` a )
main = interact $ show . solve . map read . words

module Main where

readParams :: String -> [Int]
readParams line = map (\part -> read part) (split line)

split :: String -> [[Char]]
split [] = [""]
split (c:cs)
	| c == ' ' = "" : rest
	| otherwise = (c : head rest) : tail rest
	where
           rest = split cs

sol :: Int -> Int -> Int -> Int
sol n m a = h * w
	where
		ceil c d = (c+d-1) `div` d
		h = ceil m a
		w = ceil n a

main::IO()
main = do
	inputStr <- getLine
	let params = readParams inputStr in putStrLn $ show $ sol (params !! 0) (params !! 1) (params !! 2)

solve :: Int -> Int -> Int
solve x y = (x + y - 1) `div` y

main = do
  line <- getLine
  let [n, m, a] = map read $ words line
  print $ ((solve n a) * (solve m a))

module Main where

import Data.Int (Int64)

main :: IO ()
main = mapM_ (print . (\[m, n, a] -> f m n a) . map read . words) . lines =<< getContents

f :: Int64 -> Int64 -> Int64 -> Int64
f n m a = round (fromIntegral n / fromIntegral a) * round (fromIntegral m / fromIntegral a)

main :: IO ()
main =  do
  cnt <- getLine
  let [n, m , a] = map read $ words cnt
  print $ bla n m a

bla :: Int -> Int -> Int -> Int
bla n m a =  div n a  + div m a + tmp + tmp2
  where
    tmp = if  mod n a /= 0 then 1 else 0
    tmp2 = if  mod m a /= 0 then 1 else 0

ans :: [Integer] -> Integer
ans (x : (y : (z : xs))) = ((x + z - 1) `div` z) * ((y + z - 1) `div` z)

main = do
    d <- getLine
    print (show (ans (map read (words d))))

module Main where

import Control.Monad (sequence)
import qualified Data.ByteString.Char8 as BS

main :: IO ()
main = do
  result <- (fmap (map fst)
             . sequence
             . map BS.readInt
             . BS.words) `fmap` BS.getLine
  case result of
    Just (n : m : a : _)
      | flagstoneArea == 1 -> print area
      | flagstoneArea > area -> print 1
      | otherwise ->
        print ((ceiling ((fromIntegral n) / (fromIntegral a))) *
               (ceiling ((fromIntegral m) / (fromIntegral a))))
      where
        area = n * m
        flagstoneArea = a * a
    Nothing -> error ("err: invalid input " ++ show result)

module Main where

f :: [Int] -> Int
f [n,m,a] = (div (n+a-1) a) + (div (m+a-1) a)

main = do
    a <- getLine
    print $ f $ map read $ words a

import Data.Char
--flagStones :: Fractional a => a -> a -> a -> a
flagStones n m a = (ceiling $ n / a) * (ceiling $ m / a)

main = do
  str <- getLine
  let n = fromIntegral . digitToInt . head $ str
      m = fromIntegral . digitToInt $ str !! 2
      a = fromIntegral . digitToInt . last $ str
  print $ flagStones n m a

import Data.List

solve :: [Int] -> Int
solve [n, m, a] = (div (n + a - 1)  a) * (div (m + a - 1) a)

--splitTokens :: String -> [String]
--splitTokens "" = []
--splitTokens (x:xs) = getTokens (x:xs) ""
--                    where getTokens "" s = [s]
--                          getTokens (y:ys) s = if y == ' ' the
main = do
    z <- getLine
    putStrLn $ show $ solve $ map read (words z)

to_int_array :: String -> [Int]
to_int_array str = (map read) (words str)

get_count :: Int -> Int -> Int
get_count n a = if mod n a == 0 then div n a else div n a + 1

get_all_counts :: [Int] -> Int
get_all_counts a = get_count (a!!0) (a!!2) * get_count (a!!0) (a!!2)

get_count_string :: String -> String
get_count_string s = show(get_all_counts(to_int_array s))

main = interact(get_count_string)

import Control.Monad

fn a x n
    | a * x > n = a
    | otherwise = fn (a+1) x n

main = do
    l <- liftM words getLine
    let [n,m,a] = map read l :: [Int]
    -- print (n,m,a)

    let w = fn 1 a n
    let h = fn 1 a m
    -- print (w,h)
    print (w*h)

main = print "foobarbaaaaacaaaaaaaaaaaaaa"

import Control.Monad
splitBy :: Char -> [Char] -> [[Char]]
splitBy del = foldr f [[]]
  where f c l@(x:xs) | c == del = []:l
                     | otherwise = (c:x):xs
strToInts :: [Char] -> [Int]
strToInts = (map read).(splitBy ' ')
getIntLine :: IO [Int]
getIntLine = liftM strToInts getLine

udiv :: Int -> Int -> Int
udiv a b = quot (a + b - 1) b

solve (a:b:c:xs) = udiv a c * (udiv b c)

main = do
  x <- getIntLine
  ans <- return $ solve x
  print ans

main = interact $ solve . toInts . head . lines
  where
    toInts :: String -> [Int]
    toInts = map read . words
    solve [n, m, a] = show $ ((n - 1) `quot` a + 1) * ((m - 1) `quot` a + 1)

solve :: [Int] -> Int
solve [x, y, a] = x'*y'
  where x' = ceiling $ (fromIntegral x) / (fromIntegral a)
        y' = ceiling $ (fromIntegral y) / (fromIntegral a)

main = interact (show . solve . map read . words)

squares n m a
    | mod n a == 0 = (div n a    )  * divma
    | mod n a /= 0 = (div n a + 1)  * divma
    where
      divma = if div m a <= 1 then 1 else div m a + 1

main = do
  numbers <- getLine
  let n = read ((words numbers) !! 0) :: Int
  let m = read ((words numbers) !! 1) :: Int
  let a = read ((words numbers) !! 2) :: Int
  print (squares n m a)

import System.Environment(getArgs)

p1a :: Double -> Double -> Double -> Int
p1a n m a = ceiling (n / a) * ceiling (m / a)

main :: IO ()
main = do cons <- getContents
          let [n, m, a] = fmap read $ words cons
          print $ p1a n m a

module Main where

import           Control.Applicative

f :: Integer -> Integer -> Integer -> Integer
f n m a = g n a * g m a
  where
    g x y = x `div` y + 1

main :: IO ()
main = do
  (n:m:a:_) <- words <$> getLine
  putStrLn $ show $ f (read n) (read m) (read a)

f [n, m, a] = (-n / a) * (-m / a)

main = interact $ show.f.map read.words

findFlagstoneNumber :: Int -> Int -> Int -> Int
findFlagstoneNumber n m a
  = div (n + a - 1) a
    * div (m + a - 1) a

solve :: String -> String
solve str
  = ( show
      $ findFlagstoneNumber
        (read $ args !! 0)
        (read $ args !! 1)
        (read $ args !! 2)
    ) ++ "\n"
  where args = words str

main :: IO ()
main = interact solve

module Main where

calcSquaresNeeded :: Integer -> Integer -> Integer -> Integer
calcSquaresNeeded n m a = maximum [1, n `div` a + (rest n a)] * maximum [1, m `div` a + (rest m a)]

rest :: Integer -> Integer -> Integer
rest n a
    | n `mod` a > 0 = 1
    | otherwise = 0

main = do
    s <- getLine
    let input = words s
    print $ show (calcSquaresNeeded (read (input !! 0) :: Integer) (read (input !! 1) :: Integer) (read (input !! 2) :: Integer))

main = do
    [n, a, b] <- fmap (map read . words) getLine
    print $ ((div (a + n - 1) n) * (div (b + n - 1) n))

solve :: Int -> Int -> Int
solve x y = (x + y - 1) `div` y

main = do
  line <- getLine
  let [n, m, a] = map read $ words line
  print $ ((solve n a) * (solve m a))

module Main where

calcSquaresNeeded n m a = maximum [1, n `div` a + (rest n a)] * maximum [1, m `div` a + (rest m a)]

rest n a
    | n `mod` a > 0 = 1
    | otherwise = 0

main = do
    s <- getLine
    let input = words s
    print $ show (calcSquaresNeeded (read (input !! 0) :: Integer) (read (input !! 1) :: Integer) (read (input !! 2) :: Integer))

module Main where

main :: IO ()
main = do
  input <- getLine
  print $ (solve.words) input

solve :: [String] -> Int
solve input = let
  ints = map read input :: [Int]
  [n, m, a] = ints
  nAdd = if mod n a == 0 then 0 else 1
  mAdd = if mod m a == 0 then 0 else 1
  nPlit = div n a
  mPlit = div m a
  in
   (nPlit + nAdd) * (mPlit + mAdd)

main :: IO ()
main = interact func

func :: String -> String
func s = show . func' . map read $ words s

func' :: [Int]  ->  Int
func' (n:m:a:[]) = (m `div` a + (m `dived` a)) * (n `div` a + (n `dived` a))
  where dived x y = if x `mod` y == 0 then 0 else 1
func' _ = error ""

main = do
	contents <- getContents
	let
	   numbers = map (\str -> read str :: Int) $ words contents
	   n = numbers !! 0
	   m = numbers !! 1
	   k = numbers !! 2
	print $ toInteger $ f n k * f m k

f :: Int -> Int -> Int
f n k = if n `mod` k == 0
	then n `div` k
	else (n `div` k) + 1

{-# LANGUAGE ScopedTypeVariables #-}

import Data.List.Split

main :: IO()
main = do
  line :: String <- getLine
  let x = map read $ splitOn " " line :: [Int]
  print $ (((x !! 0) + (x !! 2) - 1) `quot` (x !! 2) *
      ((x !! 1) + (x !! 2) - 1) `quot` (x !! 2))

parseString :: String -> [Int]
parseString str = map (\x -> read x::Int) $ words str

solution :: Int -> Int -> Int -> Int
solution n m a = (fst x1 + y x1) * (fst x2 + y x2)
    where
        x1 = divMod n a
        x2 = divMod m a
        y x = if snd x == 0 then 0 else 1

main :: IO()
main = do
    a <- getLine
    print $ solution ((ps a)!!0) ((ps a)!!1) ((ps a)!!2)
    where ps = parseString

main :: IO ()
main = do
    [n, m, a] <- fmap (map read . words) getLine :: IO [Int]
    let r = if (n * m) /= 0 then 1 else 0
        p = (div n a) + r
        q = (div m a) + r
    print (p * q)

calc :: Int -> Int -> Int
calc a c = ceiling $ (fromIntegral $ a)/(fromIntegral $ c)

solve :: String -> String
solve s = show $ (calc a c) * (calc b c)
  where [a, b, c] = map read (words s)

main = do
  --input <- getContents
  interact $ solve
  --putStrLn $ a
  --let [a, b, c] = map read (splitOn " " input)
  --let n = calc a c
  --putStrLn $ show $ (calc a c) * (calc b c)

solve :: [Float] -> Int
solve (n:m:a:_) = ceiling (n / a) * ceiling (m / a)

main = do
    xs <- fmap (map read . words) getLine
    print $ solve xs

import qualified Data.ByteString.Char8 as B
import Data.Maybe

getThreeIntsM = map (fst . fromJust . B.readInt) . B.words <$> B.getLine

cover x a = x `div` a + (if x `rem` a == 0 then 0 else 1)

main =
  do
    [n, m, a] <- getThreeIntsM
    putStrLn . show $ (cover n a) * (cover m a)

main = do
    [n,m,a] <- fmap (map read . words) $ getLine :: IO [Int]
    print $ (floor n a) * (floor m a)
    where floor x y = (x + y - 1) `div` y

f :: [String] -> [Int]
f = map read

--tileCount:: (Integral a) => a -> a-> a
tileCount length side
    | modulus == 0 = quotient
    | otherwise = quotient + 1
    where
        modulus = length `mod` side
        quotient = length `div` side

main = do
    z <- getLine
    let [m, n, a] = f (words z)
    print ((tileCount m a) * (tileCount n a))

ans :: [Integer] -> Integer
ans (x : (y : (z : xs))) = (x `div` z) * (y `div` z)

main = do
    d <- getLine
    print (show (ans (map read (words d))))

import Data.Char

main = do
	line <- getLine
	let n:m:a:xs = getInts 3 line
	print $ (ceil n a)*(ceil m a)

ceil :: Int -> Int -> Int

ceil x y = div (x - 1 + y) y

getInts :: Int -> String -> [Int]

getInts 0 _ = []
getInts _ [] = []
getInts x str = map stringToInt $ take x $ words str

stringToInt :: String -> Int

stringToInt [] = 0
stringToInt str = 10*(stringToInt $ init str) + digitToInt (last str)

main :: IO ()
main = do
    s <- getLine
    putStrLn $ (coverSquare' . (map read) . words) s
    return ()

coverSquare' :: [Int] -> String
coverSquare' [n,m,a] = show $ coverSquare n m a
coverSquare' _       = "coverSquare': Invalid number of arguments."

coverSquare :: Int -> Int -> Int -> Int
coverSquare n m a = (n `quot'` a) * (m `quot'` a)
  where
    c `quot'` d = (c `quot` d) + (if c `rem` d > 0 then 1 else 0)

solve :: Int -> Int -> Int
solve x y = (x + y - 1) `div` y

main = do
  line <- getLine
  let [n, m, a] = map read $ words line
  print $ ((solve n a) * (solve m a))

import Control.Applicative
main= do
	[n,m,a]<- map read. words <$> getLine:: IO [Int]
	let x= 1+ ( div n a)
	let y = 1+ (div m a)
	print $ x*y

-- -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.
-- File Name : 0001A.hs
-- Creation Date : 17-10-2012
-- Last Modified : Fri 19 Oct 2012 01:33:40 PM EEST
-- Created By : Greg Liras <gregliras@gmail.com>
--_._._._._._._._._._._._._._._._._._._._._.

{-# OPTIONS_GHC -O2 -optc-O2 #-}

import Data.Char (isSpace)
import qualified Data.ByteString as BS
import qualified Data.ByteString.Char8 as BSC

main :: IO ()
main =
    do
        all <- BS.getContents
        let Just (n, r1)    = readInt all
        let Just (m, r2)    = readInt r1
        let Just (a, _)     = readInt r2
        let x = fromIntegral $ floor $ (fromIntegral n / fromIntegral a) * (fromIntegral m / fromIntegral a)
        print $ x*x
    where
        readInt s = BSC.readInt (BSC.dropWhile isSpace s)
        readInteger s = BSC.readInteger (BSC.dropWhile isSpace s)
        readMany readf s = case readf s of
            Just (x, r) ->  let
                                (xs, t) = readMany readf r
                            in
                                (x : xs, t)
            Nothing     ->  ([], s)

f :: Int -> Int -> Int -> Int
f a b c = (*) (div (a + c - 1) c) (div (b + c - 1) c)

main = do
    str <- getLine
    {-print $ show $ words str-}
    let [a, b, c] = map (read::String->Int) $ words str
    print $ f a b c
    {-print a-}

main = print "foobarbaaaaacacsadahogebala"

findSquare :: Integer -> Integer -> Integer
findSquare squareArea a = findSquare' 1
    where
        findSquare' n = if (n * n) * (a * a) > squareArea then (n*n) else findSquare' (n + 1)

main = do
    line <- getLine
    let [n, m, a] = map (read :: String -> Integer) . words $ line

    print $ findSquare (n * m) a

import Control.Applicative

pave :: [Double] -> Int
pave [m, n, a] = ceiling (m / a) * ceiling (n / a)

main = do
	pave <$> map read <$> fmap words getLine >>= print

import Control.Monad

fn a x n
    | a * x > n = a
    | otherwise = fn (a+1) x n

main = do
    l <- liftM words getLine
    let [n,m,a] = map read l :: [Int]
    -- print (n,m,a)

    let w = fn 1 4 n
    let h = fn 1 4 m
    -- print (w,h)
    print (w*h)

import Control.Monad

main = do
    l <- liftM words getLine
    let [n,m,a] = map read l :: [Int]
    -- print (n,m,a)

    let as = map (*a) [1..]
    let w = (\x -> div x a) $ head $ dropWhile (<= m) as
    let h = (\x -> div x a) $ head $ dropWhile (<= n) as
    print (w*h)

module Main where

main :: IO ()
main = do
    args <- getLine
    let (m:n:a:xs) = map read (splitOn args)
    print (func m n a)

splitOn :: String -> [String]
splitOn list = lines (map (\x -> if x == ' ' then '\n' else x) list)

intRead :: String -> Int
intRead = read

func :: Int -> Int -> Int -> Int
func n m a =
    nPlates + mPlates
  where
    nPlates = n `div` a + nRemainder
    mPlates = m `div` a + mRemainder
    nRemainder = if n `mod` a > 0
                 then 1
                 else 0
    mRemainder  = if m `mod` a > 0
                  then 1
                  else 0


Soon a school Olympiad in Informatics will be held in Berland, n schoolchildren will participate there.At a meeting of the jury of the Olympiad it was decided that each of the n participants, depending on the results, will get a diploma of the first, second or third degree. Thus, each student will receive exactly one diploma.They also decided that there must be given at least min1 and at most max1 diplomas of the first degree, at least min2 and at most max2 diplomas of the second degree, and at least min3 and at most max3 diplomas of the third degree.After some discussion it was decided to choose from all the options of distributing diplomas satisfying these limitations the one that maximizes the number of participants who receive diplomas of the first degree. Of all these options they select the one which maximizes the number of the participants who receive diplomas of the second degree. If there are multiple of these options, they select the option that maximizes the number of diplomas of the third degree.Choosing the best option of distributing certificates was entrusted to Ilya, one of the best programmers of Berland. However, he found more important things to do, so it is your task now to choose the best option of distributing of diplomas, based on the described limitations.It is guaranteed that the described limitations are such that there is a way to choose such an option of distributing diplomas that all n participants of the Olympiad will receive a diploma of some degree.

The first line of the input contains a single integer n (3 ≤ n ≤ 3·106) — the number of schoolchildren who will participate in the Olympiad. The next line of the input contains two integers min1 and max1 (1 ≤ min1 ≤ max1 ≤ 106) — the minimum and maximum limits on the number of diplomas of the first degree that can be distributed. The third line of the input contains two integers min2 and max2 (1 ≤ min2 ≤ max2 ≤ 106) — the minimum and maximum limits on the number of diplomas of the second degree that can be distributed.  The next line of the input contains two integers min3 and max3 (1 ≤ min3 ≤ max3 ≤ 106) — the minimum and maximum limits on the number of diplomas of the third degree that can be distributed.  It is guaranteed that min1 + min2 + min3 ≤ n ≤ max1 + max2 + max3.

In the first line of the output print three numbers, showing how many diplomas of the first, second and third degree will be given to students in the optimal variant of distributing diplomas. The optimal variant of distributing diplomas is the one that maximizes the number of students who receive diplomas of the first degree. Of all the suitable options, the best one is the one which maximizes the number of participants who receive diplomas of the second degree. If there are several of these options, the best one is the one that maximizes the number of diplomas of the third degree.

import Control.Applicative

solve :: Int -> [Int] -> [Int] -> [Int] -> [Int]
solve n [min1,max1] [min2,max2] [min3,max3] =
    [min1 + min rest1 (max1 - min1), min2 + min rest2 (max2 - min2), min3 + min rest3 (max3 - min3)]
    where
        rest1 = n - min1 - min2 - min3
        rest2 = rest1 - min (max1 - min1) rest1
        rest3 = rest2 - min (max2 - min2) rest2

main :: IO ()
main = do
    n <- readLn
    fst <- map read . words <$> getLine
    snd <- map read . words <$> getLine
    trd <- map read . words <$> getLine
    putStrLn . unwords . map show $ solve n fst snd trd

main :: IO()
main = mapM_ print . solve . map read . words =<< getContents

solve :: [Int] -> [Int]
solve (n:a1:a2:b1:b2:c1:c2) =
    let a = min (n - b1 - c1) a2
        b = min (n - a  - c1) b2
        c = n - a - b
    in [a, b, c]

-- http://codeforces.com/problemset/problem/557/A
import Data.List

getLines :: Int -> IO [String]
getLines 0 = return []
getLines n = do
	l <- getLine
	ls <- getLines (n-1)
	return (l:ls)

------------------

main = do
	n <- fmap read $ getLine :: IO Int
	((m1:mx1:_):(m2:mx2:_):(m3:mx3:_):_) <-
		fmap (map (map read))
		$ fmap (map words)
		$ getLines 3 :: IO [[Int]]

	let
		fd = min (n-m2-m3) mx1 -- First distribution
		sd = min (n-fd-m3) mx2 -- Second distribution
		td = min (n - fd - sd) mx3 -- Third distribution

	putStrLn $ intercalate " " $ map show $ [fd,sd,td]

{-# LANGUAGE FlexibleContexts, ScopedTypeVariables, BangPatterns, OverloadedStrings #-}
{-# OPTIONS_GHC -O2 #-}

import Control.Applicative
import Control.Monad hiding ((<$!>))
import Control.Monad.ST.Safe
import Control.Monad.State hiding ((<$!>))
-- import Data.Array
import Data.Array.IArray
import Data.Array.IO.Safe
import Data.Array.MArray.Safe
import Data.Array.ST.Safe
import Data.Array.Unboxed
import qualified Data.ByteString.Char8 as B
import qualified Data.ByteString.Lazy.Builder as BB
import Data.Char
import qualified Data.Foldable as F
import Data.Function
import Data.Graph
import Data.Int
import Data.List
import Data.List.Split
import Data.Maybe
import Data.Monoid
import Data.Ord
import Data.Ratio
import qualified Data.Sequence as Seq
import Data.Sequence (Seq)
import Data.Set (Set)
import qualified Data.Set as Set
import Data.IntSet (IntSet)
import qualified Data.IntSet as IntSet
-- import Data.Tree
import Data.Tuple
import Data.Map.Strict (Map)
import qualified Data.Map.Strict as Map
import Data.HashMap.Strict (HashMap)
import qualified Data.HashMap.Strict as HashMap
import Data.IntMap (IntMap)
import qualified Data.IntMap as IntMap
-- import Debug.Trace
import System.IO

-- getInts = fmap (map read . words) getLine
getInts = unfoldr (B.readInt . B.dropWhile isSpace) <$> B.getLine

main = do
  n <- readLn
  [min1, max1] <- getInts
  [min2, max2] <- getInts
  [min3, max3] <- getInts

  let
    a = min max1 (n - min2 - min3)
    n' = n-a
    b = min max2 (n' - min3)
    c = n' - b

  putStrLn $ show a ++ " " ++ show b ++ " " ++ show c

parse :: String -> (Int, Int, Int, Int, Int, Int, Int)
parse contents = (s, a, b, c, d, e, f) where [s, a, b, c, d, e, f] = map read . words $ contents

main :: IO ()
main = putStrLn . unwords . map show . solve . parse =<< getContents

solve :: (Int, Int, Int, Int, Int, Int, Int) -> [Int]
solve (s, a, b, c, d, e, f)
  | s-c-e <= b = [s-c-e, c, e]
  | s-b-e <= d = [b, s-b-e, e]
  | otherwise = [b, d, s-b-d]

import Data.Char (ord)
import Data.List

readInt :: String -> Int
readInt = foldl' (\s d -> s * 10 + ord d - 48) 0

parse :: String -> (Int, Int, Int, Int, Int, Int, Int)
parse contents = (s, a, b, c, d, e, f) where [s, a, b, c, d, e, f] = map readInt . words $ contents

main :: IO ()
main = putStrLn . nopa . solve . parse =<< getContents

nopa :: (Int, Int, Int) -> String
nopa (a, b, c) = show a ++ " " ++ show b ++ " " ++ show c

solve ::(Int, Int, Int, Int, Int, Int, Int) -> (Int, Int, Int)
solve (s, a, b, c, d, e, f)
  | s-c-e <= b = (s-c-e, c, e)
  | s-b-e <= d = (b, s-b-e, e)
  | otherwise = (b, d, s-b-d)

import Data.List
answer::Int -> Int -> Int -> Int -> Int -> Int -> Int -> [Int]
answer n mn0 mx0 mn1 mx1 mn2 mx2 | mn0+mn1+mn2 == n = [mn0,mn1,mn2]
                                 | mx0+mn1+mn2 >= n = [n-mn1-mn2,mn1,mn2]
                                 | mx0+mx1+mn2 >= n = [mx0,n-mx0-mn2,mn2]
                                 | mx0+mx1+mx2 >= n = [mx0,mx1,n-mx0-mx1]
                                 | otherwise        = [mx0,mx1,mx2]
main = do
  w0 <- getLine
  let n = read w0::Int
  w1 <- getLine
  let ww1 = words w1
  let mn0 = read (ww1 !! 0)::Int
  let mx0 = read (ww1 !! 1)::Int
  w2 <- getLine
  let ww2 = words w2
  let mn1 = read (ww2 !! 0)::Int
  let mx1 = read (ww2 !! 1)::Int
  w3 <- getLine
  let ww3 = words w3
  let mn2 = read (ww3 !! 0)::Int
  let mx2 = read (ww3 !! 1)::Int
  putStrLn $ intercalate " " (map show (answer n mn0 mx0 mn1 mx1 mn2 mx2))

-- Codeforces 557A

import Data.List (intercalate)

main :: IO ()
main = getContents >>= putStrLn . intercalate " " . map show . solve . map read . words

solve :: [Int] -> [Int]
solve [n, min1, max1, min2, max2, min3, max3]
    | max1+min2+min3 >= n = [n-min2-min3, min2, min3]
    | max1+max2+min3 >= n = [max1, n-max1-min3, min3]
    | otherwise = [max1, max2, n-max1-max2]

main :: IO ()
main = putStrLn . unwords . map show . solve . map read . words =<< getContents

solve :: [Int] -> [Int]
solve [n, _, b, c, d, e, _] = [x, y, z]
  where x = min b (n - c - e); y = min d (n - x - e); z = n - x - y
solve _ = undefined

import Data.List

getList = fmap (map read . words) getLine
getValue = fmap read getLine

main = do
    n <- getValue
    [a, b] <- getList
    [c, d] <- getList
    [e, f] <- getList
    let k1 = min b (n-c-e); n2 = n - k1; k2 = min d (n2-e); n3 = n2 - k2; k3 = min f n3
    let ks = [k1, k2, k3]
    putStrLn . intercalate " " . map show $ ks

import Control.Applicative
import Data.List

main= do
	  n<-  read <$> getLine::IO Int
	  [a1,a2]<-map read. words <$> getLine::IO [Int]
	  [b1,b2]<-map read. words <$> getLine::IO [Int]
	  [c1,c2]<-map read. words <$> getLine::IO [Int]
	  let nn = n-a1-b1-c1
	  let a3= min nn (a2-a1)
	  let b3 =max 0 (min (nn-a3) (b2-b1))
          let c3= max 0 (min (nn-a3-b3) (c2-c1))
	  putStrLn $ intercalate " " $ map show [a1+a3,b1+b3,c1+c3]

type Input = (Int, [(Int, Int)])

parse :: String -> Input
parse contents = (n, [(min1, max1), (min2, max2), (min3, max3)])
                 where [n, min1, max1, min2, max2, min3, max3] = map read . words $ contents

solve :: Input -> [Int]
solve (_, [])           = []
solve (n, (_, ma) : cs) = a : solve (n - a, cs)
                          where a = min ma (n - sum (map fst cs))

pprint :: [Int] -> IO ()
pprint = putStrLn . unwords . map show

main :: IO ()
main = pprint . solve . parse =<< getContents

{-# LANGUAGE ScopedTypeVariables #-}

import Control.Applicative

solve n0 n1 n2 x0 x1 x2 k =
  let
    k0 = min x0 (k - n1 - n2)
    k1 = min x1 (k - k0 - n2)
    k2 = k - k0 - k1
  in
    [k0, k1, k2]

main = do
  [k, n0, x0, n1, x1, n2, x2]::[Int] <- map read . words <$> getContents
  putStrLn . unwords . map show $ solve n0 n1 n2 x0 x1 x2 k

-- http://codeforces.com/problemset/problem/557/A
import Data.List

getLines :: Int -> IO [String]
getLines 0 = return []
getLines n = do
	l <- getLine
	ls <- getLines (n-1)
	return (l:ls)

------------------

main = do
	n <- fmap read $ getLine :: IO Int
	((m1:mx1:_):(m2:mx2:_):(m3:mx3:_):_) <-
		fmap (map (map read))
		$ fmap (map words)
		$ getLines 3 :: IO [[Int]]

	let
		fd = min (n-m2-m3) mx1 -- First distribution
		sd = min (fd+m3) mx2 -- Second distribution
		td = n - fd - sd -- Third distribution

	putStrLn $ intercalate " " $ map show $ [fd,sd,td]