{-# LANGUAGE ScopedTypeVariables #-}
{-# LANGUAGE BangPatterns #-}

import Control.Applicative
import Control.Monad
import Control.Arrow
import Data.List
import Data.Maybe
import Data.Char
import qualified Data.ByteString.Char8 as B
import Text.Printf

import Debug.Trace

readInt = ( readLn :: IO Int )
readInts = map ( read :: String -> Int ) . words <$> getLine

getList = map ( fst . fromJust . B.readInt ) . B.words <$> B.getLine

which a b f = if f then a else b
mp [ a, b ] = ( a, b )

main = do
	[ i, o, _, j, l, _, _ ] :: [ Integer ] <- map read . words <$> getLine
	print $ o + solve i j l

solve a b c
	| 0 < mi = max ( mi * 3 + solve' ( a - mi ) ( b - mi ) ( c - mi ) ) ( ( mi - 1 ) * 3 + solve' ( a - mi + 1 ) ( b - mi + 1 ) ( c - mi + 1 ) )
	| otherwise = solve' a b c
	where
		mi = minimum [ a, b, c ]
		d = ( * 2 ) . ( `div` 2 )
		solve' a b c = d a + d b + d c