The total value of money can be calculated by adding the money related to the $5 bills and the money related to the $12 bills, like this:
Total money = Money $5 bills + Money $12 bills
The money in $5 bills is calculated by multiplying the number of $5 bills in the stack "x" by 5, then we can write:
Money $5 bills = 5x
Similarly for the money in $12 bills:
Money $12 bills = 12y
By replacing 5x for Money $5 bills and 12y for Money $12 bills into the above equation, we get:
Total money = 5x + 12y
Since the total value of the money was $1710, we can rewrite the above equation to get:
1710 = 5x + 12y
We are also told that there were 47 more $5 bills than $20 bills, then we can write the following expression:
x = 47 + y
By replacing 47 + y for x into 1710 = 5x + 12y, we get:
1710 = 5(47 + y) + 12y
1710 = 5×47 + 5y + 12y
1710 = 235 + 17y
1710 - 235 = 17y
1475 = 17y
1475/17 = y
87 = y
y = 87
By replacing 87 for y into x = 47 + y, we get:
x = 47 + 87 = 134
Then, there were 134 $5 bills and 87 $12 bills