n=int(input())
list1=input().split( )
list2=[]
x=0
y=0
N=1
z=0
count=0
for a in list1:
    x=list1[a]
    y=list1[a+1]
    N*=x*y
    a+=2
while z<=N:
    if N%z==0:
        list2.append(z)
    z+=1
for i in list2:
    count+=list2[i]
print(str(count%10**9+7))