N=int(input()) a=[int(input()) for _ in range(N+1)] b=[int(input()) for _ in range(N+1)] am=bm=0 for i in range(N+1): bm+=b[i] am+=a[N-i]*bm print(am%(1000000007))