import scala.math._

object Main {
  val sc = new java.util.Scanner(System.in)
  def main(args: Array[String]) {
    while(true) {
      val n = sc.nextInt()
      if(n == 0) return

      var ans = 0
      for(i <- 1 to n/4) {
        ans += sc.nextInt()
      }
      println(ans)
    }
  }
}