A textbook store sold a combined total of 412 chemistry and math textbooks in a week. The number of chemistry textbooks sold was three times the number of math textbooks sold. How many textbooks of each type were sold?