Use the following data to calculate the cost of merchandise sold:
Sales: $80,000
Beginning inventory: $5,000
Purchase: $21,800
Purchase discounts: $790
Ending inventory: $5,100

A. $21,650
B. $20,190
C. $21,560
D. $20,910