Aaron bought 8 red flags for the parade. Large flags cost $20 each. Medium flags cost $12 each. Aaron spent $112 in all. How many large flags (L) and how many medium flags (M) did he buy?