There are four types of common coins in   US   currency:

   quarters   (25 cents)
   dimes   (10 cents)
   nickels   (5 cents),   and 
   pennies   (1 cent) 


There are six ways to make change for 15 cents:

   A dime and a nickel 
   A dime and 5 pennies
   3 nickels
   2 nickels and 5 pennies
   A nickel and 10 pennies
   15 pennies


Task

How many ways are there to make change for a dollar using these common coins?     (1 dollar = 100 cents).



Optional

Less common are dollar coins (100 cents);   and very rare are half dollars (50 cents).   With the addition of these two coins, how many ways are there to make change for $1000?

(Note:   the answer is larger than   232).



References

 an algorithm from the book Structure and Interpretation of Computer Programs.
 an article in the algorithmist.
 Change-making problem on Wikipedia.


 
       identification division.
       program-id. CountCoins.
 
       data division.
       working-storage section.
       77  i                      pic 9(3).
       77  j                      pic 9(3).  
       77  m                      pic 9(3) value 4.
       77  n                      pic 9(3) value 100.  
       77  edited-value           pic z(18).
       01  coins-table            value "01051025".
           05 coin                pic 9(2) occurs 4.
       01  ways-table.
           05 way                 pic 9(18) occurs 100.
 
       procedure division.
       main.
           perform calc-count
           move way(n) to edited-value
           display function trim(edited-value)
           stop run
           .
       calc-count.
           initialize ways-table
           move 1 to way(1)
           perform varying i from 1 by 1 until i > m
              perform varying j from coin(i) by 1 until j > n
                 add way(j - coin(i)) to way(j)
              end-perform
           end-perform
           .           
 