n = int(input()) mod = 10**9+7 alist = [ int(input()) for i in range(n+1) ] for i in range(1,n+1): alist[i] = ( alist[i-1] + alist[i] ) % mod for i in range(n+1): alist[n-i] = (int(input()) * alist[n-i]) % mod print(sum(alist) % mod)