p=[];System.in.eachLine{i=-1;it.each{p[++i]=it-' '?:p[i]?:' '};println p.sum()}