eval"N,*A="+`dd`.split*?, s,*I=0,x=i=1,1 A.map{|a|s+=a*x%=M=10**9+7;x*=I[i].*N-i;I<<-I[M%i+=1]*(M/i)} p s%M