M=10**9+7;n,*a=`dd`.split.map &:to_i;b=a.pop(n+1) s=0 c=b.reduce :+ a.each_with_index{|e,i|s=(s+e*c)%(10**9+7);c-=b[n-i]} p s