import scala.io.StdIn.readInt

object Main {

  def scan(sum:Int,i:Int):Int = {
    if(i==0) sum
    else {
      val n = readInt
      scan(sum+n,i-1)
    }
  }

  def main(args:Array[String]) = {
    val buf = Iterator.continually(readInt).takeWhile(_ != 0).map { n=>
      scan(0,n/4)
    }
    println(buf.mkString("\n"))
  }
}