import io.StdIn.readLine


object Main {

  def isOdd(i: Int): Boolean = i % 2 == 1

  def main(args: Array[String]): Unit = {
    val Array(i, o, t, j, l, s, z) = readLine().split(' ').map(_.toInt)
    val k = o + (j / 2) * 2 + (l / 2) * 2
    if (isOdd(j) && isOdd(l)) {
      if (isOdd(i)) println(k + i + 2)
      else println(k + i + 1)
    } else {
      if (isOdd(i)) println(k + i - 1)
      else println(k + i)
    }
  }

}
