Explanation:
r = red apples, g = green apples, t = total
3r + g = t
7(3r + g = t)
21r + 7g = 7t
The cost of the apples was not included in the question, but you can multiply the total of one bag by 7, or the cost of the individual apples by the values above.