Raw materials inventory was $5,000 at the beginning of the year and $12,000 at the end of the year. During the year, a total of $27,000 in raw materials were purchased, including $4,000 of indirect materials that were put into manufacturing overhead during the period. Calculate the cost of direct materials used during the period.