12 divided by 3 is 4, times the numerator (1) is the number of apples Max ate out of the ones he bought (4 eaten out of 12 bought, or 4/12).
12 divided by 4 is 3, times the numerator (1) is the number of apples Sam ate out of the ones he bought (3 eaten out of 12 bought, or 3/12).
So, together they ate 7 apples, and separately Max ate 4 and Sam ate 3.