Mary went shopping in two stores with her birthday gift money. In the first store, she spent three-fourths of what she had plus $3. In the second store, she spent two-thirds of what was left plus $2. She then had $5 left. How many dollars did she begin with?