How many ways are there of arranging three different Math books, five different History books and four different Science books side by side on a shelf if books of the same subject must be together?