program tetromino_tiling
  implicit none
  integer, parameter :: i = 1, o = 2, t = 3, j = 4, l = 5, s = 6, z = 7
  integer(8) :: a(7), k
  a = 0_8
  read(*,*) a(i:z)
  k = 2_8*(a(i)/2_8+a(j)/2_8+a(l)/2_8)+a(o)
  write(*,'(i0)') k
  stop
end program tetromino_tiling