Pam has 35 bags of coins. Some of the bags contain 6 gold coins, and the rest contain 8 silver coins. If Pam has 240 coins in all, how many bags of each type of coin does Pam have?