#yuki754 n=int(raw_input()) a=[] for i in xrange(n+1): a.append(int(raw_input())) b=[] for i in xrange(n+1): b.append(int(raw_input())) suma=sum(a) res=0 for i in xrange(n,-1,-1): res=(res+suma*b[n-i])%(10**9+7) suma-=a[i] print res