n=int(input()) a=[] b_s=[0] for i in range(n+1): a.append(int(input())) for i in range(n+1): v=int(input()) b_s.append(b_s[-1]+v) ans=0 mod=10**9+7 for i in range(n+1): ans+=a[n-i]*b_s[i+1] ans%=mod print(ans)