UVa 10220 - I Love Big Numbers !

10220 - I Love Big Numbers !

 * http://icpcres.ecs.baylor.edu/onlinejudge/external/102/10220.html

Summary
This is a simple BigNum problem. You need to know what is factorial!

Explanation
$$n ! = n \times (n-1) \times (n-2) \times...\times 2 \times 1 = 1 \times 2 \times 3 \times...\times m \times...\times (n-1) \times (n)$$

Just calculate 1000! (from 1 to 1000) by easy using array product and for every m find sum of the digits of m! and store that in other array. then for ever input data, output from array.

Gotchas
and run time will be about 0.040s
 * Do not worry about TLE, in fact you just calculate 1000!.

Input
5 60 100 555 600 789 951 1000

Output
3 288 648 5193 5715 7965 10038 10539