INPUT "input array length ", n
DIM M(n) AS INTEGER
RANDOMIZE TIME
FOR i = 1 TO n
M(i) = RND(3) * 20 - 10
NEXT
sum = 0
current = 1
FOR i = 1 TO n
current = current * i
sum = current * M(i) + sum
NEXT
FOR i = 0 TO n
PRINT M(i);
NEXT
PRINT "sum=", sum