A science teacher is arranging her books on a shelf. She has 4 astronomy books, 3 biology books, and 2 chemistry books. How many ways can she arrange these books on the shelf if the books at the end must be chemistry books?