module Main where

import Control.Applicative
import Data.Int

data Test = Test Int64 Int64 Int64 Int64 Int64 Int64 Int64

solve :: Test -> Int64
solve (Test ai ao _ aj al _ _) = ao + go ai aj al
    where go ai aj al | odd ai && odd aj && odd al = 3 + go (ai - 1) (aj - 1) (al - 1)
                      | otherwise = 2 * ((ai `div` 2) + (aj `div` 2) + (al `div` 2))

test0 = Test 2 1 1 0 0 0 0
test1 = Test 0 0 10 0 0 0 0

runTests = map solve [test0, test1]

main :: IO ()
main = do
  [ai, ao, at, aj, al, as, az] <- map read . words <$> getLine
  print . solve $ Test ai ao at aj al as az