$%=1e9+7;<>;@a=<>;($t+=($s+=shift@a)*pop@a)%=$%while@a;print$t,$/