Randy and Sandy have a total of 20 books between them. After Sandy loses three by leaving them on the bus, and some birthday gifts double Randy's collection, their total increases to 30 books. How many books did each have before these changes?

Explanation please :)