#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 */
scalar_t__ EOF;
int lcm(int, int);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *);
int main() {
  int n, ans, k, i;
  while (scanf("%d", &n) != EOF) {
    if (n == 0)
      break;
    scanf("%d", &ans);
    for (i = 1; i < n; i++) {
      scanf("%d", &k);
      ans = lcm(ans, k);
    }
    printf("%d\n", ans);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
mov    0x2e92(%rip),%rcx
cmp    (%rcx),%rax
je     11d1 <main+0xa1>
cmpl   $0x0,-0x8(%rbp)
jne    116e <main+0x3e>
jmp    11d1 <main+0xa1>
lea    0xe8b(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11bd <main+0x8d>
lea    0xe68(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0xc(%rbp),%edi
mov    -0x10(%rbp),%esi
call   1040 <lcm@plt>
mov    %eax,-0xc(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1185 <main+0x55>
mov    -0xc(%rbp),%esi
lea    0xe3c(%rip),%rdi
call   1030 <printf@plt>
jmp    113f <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
sub    $0x18,%rsp
lea    0xebb(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
mov    0x2e92(%rip),%r14
cmp    (%r14),%rax
je     1205 <main+0xd5>
cmpl   $0x0,0xc(%rsp)
je     1205 <main+0xd5>
lea    0xe8f(%rip),%rbx
lea    0x10(%rsp),%r12
lea    0x14(%rsp),%r15
lea    0xe81(%rip),%r13
lea    0xc(%rsp),%rbp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
cmpl   $0x2,0xc(%rsp)
jl     11e0 <main+0xb0>
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <scanf@plt>
mov    0x10(%rsp),%edi
mov    0x14(%rsp),%esi
call   1040 <lcm@plt>
mov    %eax,0x10(%rsp)
add    $0x1,%ebp
cmp    0xc(%rsp),%ebp
jl     11b0 <main+0x80>
lea    0xc(%rsp),%rbp
jmp    11e4 <main+0xb4>
nopl   0x0(%rax)
mov    0x10(%rsp),%eax
mov    %r13,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
cmp    (%r14),%rax
je     1205 <main+0xd5>
cmpl   $0x0,0xc(%rsp)
jne    1190 <main+0x60>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@EOF = global i64 0
@.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 = %28, %0
%7 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%8 = load i64, i64* @EOF
%9 = icmp ne i64 %7, %8
br i1 %9, label %10, label %31
10: ; preds = %6
%11 = load i32, i32* %2
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10
br label %31
14: ; preds = %10
%15 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
store i32 1, i32* %5
br label %16
16: ; preds = %25, %14
%17 = load i32, i32* %5
%18 = load i32, i32* %2
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %28
20: ; preds = %16
%21 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %4)
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 @lcm(i32 %22, i32 %23)
store i32 %24, i32* %3
br label %25
25: ; preds = %20
%26 = load i32, i32* %5
%27 = add nsw i32 %26, 1
store i32 %27, i32* %5
br label %16
28: ; preds = %16
%29 = load i32, i32* %3
%30 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
br label %6
31: ; preds = %13, %6
ret i32 0
}

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