import Control.Applicative ((<$>)) main :: IO () main = do getLine b <- readLn solve b <$> map read <$> words <$> getLine >>= mapM_ print solve :: Int -> [Double] -> [Double] solve b as = [sum . map diff $ as, sum . map intg $ as] where diff a = a * (fromIntegral b) ** (a-1) intg a | abs (a + 1.0) < 0.01 = log (fromIntegral b) | otherwise = (fromIntegral b) ** (a+1) / (a+1)