Need some help in designing this dynamic programming algorithm

There is a large supply of a set of two types of rods R, where each type 1 rod is of length r1 with
cost c1 and each type 2 rod is of length r2 with cost c2. You are given a set of n required cut_pieces S = {x1, x2, . . . , xn} where each cut-piece xi is less than both r1 and r2. You are required
to select the required number of rods of each type to accommodate all the pieces of S so that
the total cost of rods used is minimum. Given that, if a rod is partly used, the full rod cost has
to be paid, develop an optimal algorithm.