import Data.Maybe
import Control.Monad
import qualified Data.ByteString.Char8 as C

readInt' = fst.fromJust.C.readInt
readLnInt = map readInt'.C.words<$>C.getLine
readCsInt n = concat<$>replicateM n readLnInt

x ? (a,b) = if x then a else b
a~>(f,x) = [a] ++ (null x)?([],f x)
half = flip div 2
aliq = ((0==).).mod

main = do
 getLine
 inputs <- readLnInt
 print $ solve inputs

solve s = sum $ solve2 s

solve2 s@(a:b) = (solve3 s)~>(solve2,b)

solve3 s@(a:b:c) = a*b + (null c)?(0,solve3 (a:c))
solve3 [a] = 0
