| Concurso de programación ANIEI 2023 |
|---|
| Закончено |
One day Franco was waiting for the new game, Coding Hero. It is a two-player game so he decided to play it with his good friend Rafa.
This game consists of several team matches where there is a programming problem which they had to solve as quickly as possible, they started with a score equal to 1 and due to the combo breaker dynamics that the game has, this score is multiplied each time a player solves a problem.
When Franco solves a problem the score they had is multiplied by $$$A$$$, when Rafa solves a problem the score is multiplied by $$$B$$$, there could be cases where the problem is so difficult that no one could solve it, in that case, they just go on to the next problem without losing or gaining points.
They were so obsessed with the game that they played and played, and they realized that their scores vary a lot depending on who solves the problems, Grecia with a lot of curiosity, began to think about what would be the sum of scores of all possible outcomes.
Two results are different if in some games the person who solved the problem is different, help Grecia to know what is the sum of the scores of all possible games! Since the number can be very large, print it modulo $$$10^9+7$$$.
An integer $$$T$$$ ($$$ 1 \leq T \leq 10^5 $$$) that indicates the number of cases you have to answer, followed by $$$T$$$ lines each defined by 3 integers $$$N$$$, $$$A$$$ and $$$B$$$ ( $$$ 1 \leq N \leq 1000, 1 \leq A, B \leq 10^8 $$$). Which refer to the number of matches in the game, Franco's multiplier and Rafa's multiplier.
$$$T$$$ lines each, where the $$$i$$$-th line contains an integer, representing the answer of $$$i$$$-th case from the input.
1 1 6 9
16
1 2 8 4
169
3 6 2 7 10 3 8 9 1 1
1000000 917363797 19683
| Название |
|---|


