A baker sells loaves of bread in two different sizes: small and large. The baker has 40 kilograms of flour to work with. Small loaves require 0.4 grams of flour and large loaves require 0.8 grams of flour. Additionally, the baker has 800 grams of yeast; each loaf requires 10 grams. If the baker makes $1.20 profit from each large loaf and $0.50 from each small loaf, and he wants to maximize his profits, how many loaves of each size should he make?