mod=10**9+7 n=int(input())+1 a=[int(input()) for _ in range(n)] b=[int(input()) for _ in range(n)] s=sum(b) ans=0 for i in range(n): ans=(ans+a[i]*s)%mod s-=b[n-i-1] print(ans)