A bag contains 40 red and green marbles. The number of green marbles, g, is 9 times the number of red marbles, r.
How many red marbles are in the bag?