#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main(void) {
  int kind, i, sum, temp;
  while (1) {
    scanf("%d", &kind);
    if (kind == 0)
      break;
    sum = 0;
    for (i = 0; i < kind * (kind - 1) / 2; i++) {
      scanf("%d", &temp);
      sum += temp;
    }
    printf("%d\n", sum / (kind - 1));
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    114e <main+0x2e>
jmp    11c9 <main+0xa9>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
cmp    %ecx,%eax
jge    11aa <main+0x8a>
lea    0xe76(%rip),%rdi
lea    -0x14(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x14(%rbp),%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    115c <main+0x3c>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
cltd
idiv   %ecx
mov    %eax,%esi
lea    0xe44(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
je     11ca <main+0xaa>
lea    0xeb4(%rip),%r13
lea    0x4(%rsp),%r14
lea    0xeab(%rip),%r15
mov    %rsp,%r12
jmp    1181 <main+0x61>
nopl   (%rax)
mov    %ebp,%eax
cltd
idiv   %ecx
mov    %r15,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
je     11ca <main+0xaa>
lea    -0x1(%rax),%ecx
imul   %ecx,%eax
xor    %ebp,%ebp
cmp    $0x2,%eax
jl     1160 <main+0x40>
xor    %ebp,%ebp
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %r14,%rsi
call   1040 <scanf@plt>
add    0x4(%rsp),%ebp
add    $0x1,%ebx
mov    (%rsp),%eax
lea    -0x1(%rax),%ecx
imul   %ecx,%eax
mov    %eax,%edx
shr    $0x1f,%edx
add    %eax,%edx
sar    %edx
cmp    %edx,%ebx
jl     11a0 <main+0x80>
jmp    1160 <main+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %0, %28
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %6
br label %34
11: ; preds = %6
store i32 0, i32* %4
store i32 0, i32* %3
br label %12
12: ; preds = %25, %11
%13 = load i32, i32* %3
%14 = load i32, i32* %2
%15 = load i32, i32* %2
%16 = sub nsw i32 %15, 1
%17 = mul nsw i32 %14, %16
%18 = sdiv i32 %17, 2
%19 = icmp slt i32 %13, %18
br i1 %19, label %20, label %28
20: ; preds = %12
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %5)
%22 = load i32, i32* %5
%23 = load i32, i32* %4
%24 = add nsw i32 %23, %22
store i32 %24, i32* %4
br label %25
25: ; preds = %20
%26 = load i32, i32* %3
%27 = add nsw i32 %26, 1
store i32 %27, i32* %3
br label %12
28: ; preds = %12
%29 = load i32, i32* %4
%30 = load i32, i32* %2
%31 = sub nsw i32 %30, 1
%32 = sdiv i32 %29, %31
%33 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
br label %6
34: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = load i32, i32* %1
%7 = icmp eq i32 %6, 0
br i1 %7, label %33, label %8
8: ; preds = %0, %25
%9 = phi i32 [ %31, %25 ], [ %6, %0 ]
%10 = add nsw i32 %9, -1
%11 = mul nsw i32 %10, %9
%12 = icmp sgt i32 %11, 1
br i1 %12, label %13, label %25
13: ; preds = %8, %13
%14 = phi i32 [ %18, %13 ], [ 0, %8 ]
%15 = phi i32 [ %19, %13 ], [ 0, %8 ]
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%17 = load i32, i32* %2
%18 = add nsw i32 %17, %14
%19 = add nuw nsw i32 %15, 1
%20 = load i32, i32* %1
%21 = add nsw i32 %20, -1
%22 = mul nsw i32 %21, %20
%23 = sdiv i32 %22, 2
%24 = icmp slt i32 %19, %23
br i1 %24, label %13, label %25
25: ; preds = %13, %8
%26 = phi i32 [ 0, %8 ], [ %18, %13 ]
%27 = phi i32 [ %10, %8 ], [ %21, %13 ]
%28 = sdiv i32 %26, %27
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
%30 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%31 = load i32, i32* %1
%32 = icmp eq i32 %31, 0
br i1 %32, label %33, label %8
33: ; preds = %25, %0
ret i32 0
}