[Production based model solution.] Think of manufacturing a very desirable product, "good stuff." As your production increased you forgot to keep track of your accumulated costs but you did keep your receipts showing you the marginal rates you were charged for materials and labor. Based on this information, do you think you could give your accumulated costs approximately (or exactly) at any stage of the production? As a practical matter, this is what accountants do in reviewing the accumulation of costs. With the information you have retained you should be able to reproduce the accumulation of costs with great accuracy. 
 
Units 
produced
Marginal cost
$/ unit 
0 to 5
4.00
5 to 12
3.50
12 to 20
3.25
20 to 40
2.00
40 to 50
3.00
 
Graph of Marginal Cost 
per Unit Produced
 
The accumulated cost function that matches the  given marginal costs
x : Units 
produced in the inteval
Accumated cost as a function of the units produced: x
0 to 5
4.00 x
5 to 12
20.00 + 3.50( x - 5)
12 to 20
44.50 + 3.25( x -12)
20 to 40
70.50 + 2.00( x - 20)
40 to 50
110.50 + 3.00( x - 40)
 

Graph of Accumulated Cost as a Function of the Number of Units Produced