The ratio of the number of 50-cent coins to the number of $1 coins in a piggybank was 2:1. When 12 more 50-cent coins were added into the piggybank, the ratio of the number of 50-cents coins to the $1 coins became 7:2. What was the total value of all the coins in the piggybank at first?