main = do getLine b <- readLn as <- map read . words <$> getLine print (dc b as) print (ic b as) dc b as = sum $ zipWith (*) as (sequence (map (\a x -> (x**(a-1))) as) b) ic b as = sum $ zipWith (*) cs xs where cs = map (\a -> if a==(-1) then 1 else (a+1)**(-1)) as xs = sequence (map (\a x -> if a==(-1) then log x else (x**(a+1))) as) b