import qualified Data.ByteString.Char8 as C
import Data.Vector.Unboxed
import Prelude hiding (tail)

main = C.interact $ put . sol . get
get = unfoldr (C.readInt . C.dropWhile (<'0'))
put = C.pack . show
sol = ifoldl' (\s i a -> if even i then s-a+1 else s+a) 0 . tail