Terrence Jones sells lumber. He earns 4 percent commission on the first $5,000, 8 percent on the next $5,000, and 12 percent on sales over $10,000. Last month he sold $18,000 worth of lumber. What was his total commission?