from itertools import accumulate n = int(input()) A = [int(input()) for _ in range(n + 1)] B = [int(input()) for _ in range(n + 1)] mod = 10**9 + 7 a=list(accumulate(B)) ans=0 for i in range(n+1): ans+=A[i]*a[n-i] ans%=mod print(ans)