f [] = True
f (x:[]) = True
f (x:y:xs)=if x=' ' && y=' ' then False else f xs 

main=do
 s<-getLine
 let l = length s
 print$map sum$map (map read).words[sm|filter(/=' ')sm==s,last sm/=' ',head sm/=' ',f sm]
