In a school library, there are 12 different books on mathematics, 8 different books on science, and 5 different books on literature. A student wants to select a total of 4 books to borrow, with the condition that at least one book must be from each subject area.
How many different ways can the student choose the books?