Dynamic duplication + calculation

I wanted to create a calculation script. Buts its not normal calculator.

  1. The script would 1st randomize out the amount (15-150)
  2. I will have 5 movie clip. Each represent an exact number. (1, 5, 10, 20, 50)
  3. According to that 5 specific numbers, the area/movie clip will be duplicated in order to makes the amount of any of the 5 number, total up as the randomize amount.
  4. The amount of the area duplicate would be 4-10

Exp:

I would 1st randomize out the amount: 124
So in order to have either of that 5numbers total up as 124, It would duplicate out 7 area()

( )+( )+( )+( )+( )+( )+( )=124

Now from here I would drag in the 5 numbers given to sum up to 124

(50)+(50)+(20)+(1)+(1)+(1)+(1)=124

Any ideas or guide on how to do this?