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 = ai + aj + al
                      | even ai && even aj && even al = ai + aj + al
                      | ai == 0 || aj == 0 || al == 0 = 2 * (ai `div` 2 + aj `div` 2 + al `div` 2)
                      | otherwise = max u v
                      where u = 2 * (ai `div` 2 + aj `div` 2 + al `div` 2)
                            v = 3 + 2 * ((ai - 1) `div` 2 + (aj - 1) `div` 2 + (al - 1) `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