'''
# Sample code to perform I/O:

name = input()                  # Reading input from STDIN
print('Hi, %s.' % name)         # Writing output to STDOUT

# Warning: Printing unwanted or ill-formatted data to output will cause the test cases to fail
'''

# Write your code here
prod = 1
n = int(input())
inp = input().split(" ")
for x in inp:
    prod = (prod * int(x)) % (pow(10, 9) + 7)

print(prod)
