System.in.eachLine{y=0 a=it.split()*.toLong()+0 a.sum{a=a.sum{[y-(y=-it)]}} println y}