let () =
  let rec read () =
    let n = read_int () in
    if n = 0 then ()
    else
      begin
        let rec loop sum = function
            0 -> sum
          | i ->
             let m = read_int () in
             loop (sum+m) (i-1)
        in
        Printf.printf "%d\n" (loop 0 (n/4));
        read ()
      end
  in
  read ();;