import Data.List
main=do
    ns<-map read.concat.f <$> getLine::IO[Int]
    print.sum $ ns

f ss =(:) [ss] $  concatMap (\(l,r)->g l r) $ map (flip splitAt ss) [1..(length ss)- 1]
g l r = map (\s->l:s) (f r)
