#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__ pow(int, int);
int /*<<< orphan*/ printf(char *, int);
scalar_t__ scanf(char *, int *);
int main() {
  int n;
  scanf("%d", &n);
  int nums, s = 1;
  for (int a = 0; a < n && scanf("%d", &nums); a++) {
    s = (s * nums) % (int)(pow(10, 9) + 7);
  }
  printf("%d\n", s);
  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   1040 <scanf@plt>
movl   $0x1,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%ecx
xor    %eax,%eax
cmp    -0x8(%rbp),%ecx
mov    %al,-0x15(%rbp)
jge    1188 <main+0x58>
lea    0xe8b(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    1198 <main+0x68>
jmp    11cf <main+0x9f>
mov    -0x10(%rbp),%eax
imul   -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    $0xa,%edi
mov    $0x9,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
mov    -0x1c(%rbp),%eax
add    $0x7,%rcx
cltd
idiv   %ecx
mov    %edx,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    115d <main+0x2d>
mov    -0x10(%rbp),%esi
lea    0xe2a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
mov    %rsp,%rsi
call   1040 <scanf@plt>
cmpl   $0x0,(%rsp)
jle    119b <main+0x6b>
mov    $0x1,%ebx
xor    %ebp,%ebp
lea    0xea6(%rip),%r14
lea    0x4(%rsp),%r15
nop
mov    %r14,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
test   %rax,%rax
je     11a0 <main+0x70>
imul   0x4(%rsp),%ebx
mov    $0xa,%edi
mov    $0x9,%esi
call   1050 <pow@plt>
mov    %rax,%rcx
add    $0x7,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
add    $0x1,%ebp
mov    %edx,%ebx
cmp    (%rsp),%ebp
jl     1160 <main+0x30>
jmp    11a0 <main+0x70>
mov    $0x1,%ebx
lea    0xe5c(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
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
%6 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
store i32 1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %24, %0
%8 = load i32, i32* %5
%9 = load i32, i32* %2
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %14
11: ; preds = %7
%12 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %3)
%13 = icmp ne i64 %12, 0
br label %14
14: ; preds = %11, %7
%15 = phi i1 [ false, %7 ], [ %13, %11 ]
br i1 %15, label %16, label %27
16: ; preds = %14
%17 = load i32, i32* %4
%18 = load i32, i32* %3
%19 = mul nsw i32 %17, %18
%20 = call i64 @pow(i32 10, i32 9)
%21 = add nsw i64 %20, 7
%22 = trunc i64 %21 to i32
%23 = srem i32 %19, %22
store i32 %23, i32* %4
br label %24
24: ; preds = %16
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %7
27: ; preds = %14
%28 = load i32, i32* %4
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %28)
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 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = bitcast i32* %2 to i8*
%6 = load i32, i32* %1
%7 = icmp sgt i32 %6, 0
br i1 %7, label %8, label %13
8: ; preds = %0, %16
%9 = phi i32 [ %23, %16 ], [ 0, %0 ]
%10 = phi i32 [ %22, %16 ], [ 1, %0 ]
%11 = call i64 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %8, %16, %0
%14 = phi i32 [ 1, %0 ], [ %22, %16 ], [ %10, %8 ]
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
ret i32 0
16: ; preds = %8
%17 = load i32, i32* %2
%18 = mul nsw i32 %17, %10
%19 = call i64 @pow(i32 10, i32 9)
%20 = trunc i64 %19 to i32
%21 = add i32 %20, 7
%22 = srem i32 %18, %21
%23 = add nuw nsw i32 %9, 1
%24 = load i32, i32* %1
%25 = icmp slt i32 %23, %24
br i1 %25, label %8, label %13
}