{-# LANGUAGE OverloadedStrings #-} import qualified Data.ByteString.Char8 as C import Data.Char import Text.Printf nCr :: Integer -> Integer -> Integer nCr n r = foldl (*) 1 [n-r+1..n] `div` foldl (*) 1 [1..r] solve :: Int -> (Integer, Integer) solve n | n < 32 = (x, y) | otherwise = (0, 0) where n' = fromIntegral n x = nCr 31 n' y = (2 ^ (31 :: Integer) - 1) * x * n' `div` 31 main :: IO () main = do ss <- C.getLine let (x, ss2) = nextInt ss let (a, b) = solve x printf "%d %d\n" a b nextInt :: C.ByteString -> (Int, C.ByteString) nextInt ss | isDigit x || x == '-' = nextInt2 0 ss | otherwise = nextInt $ C.tail ss where x = C.head ss nextInt2 :: Int -> C.ByteString -> (Int, C.ByteString) nextInt2 n ss | C.null ss = (n, ss) | y == '-' = (-z,zs) | isDigit y = nextInt2 (n * 10 + (digitToInt y)) ys | otherwise = (n, ys) where y = C.head ss ys = C.tail ss (z,zs) = nextInt2 0 ys