S4P1 - Sum of factorial

Mohamed has a new task and as you are mohamed's friend he asks you to develop perform this task .Task is about calculate sum of factorial for all digits in an integer number N.

Input

input contain N where 1<=<=1000000000000

Output

sum of factorial for all digits in N

print endl after the output

Example

Input:
2431
Output:
33

Added by:mohamed gamal
Date:2012-01-27
Time limit:2s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:C++ 4.3.2 CPP

© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.