import sys input=lambda: sys.stdin.readline().rstrip() n=int(input()) A=[int(input()) for _ in range(n+1)] B=[int(input()) for _ in range(n+1)] for i in range(1,n+1): B[i]+=B[i-1] ans=0 mod=10**9+7 for i in range(n+1): ans+=A[i]*B[n-i] if ans>mod: ans%=mod print(ans)