Ethan had muffins and Elijah had cookies. Both gave half of what they had to each other. Ethan sold 10 muffins and Elijah sold 22 cookies. In the end, the ratios of muffins to cookies for Ethan and Elijah were 1 : 8 and 1 : 6 respectively. How many muffins did Ethan have at first?