Problem #18
Game
Sandeep and Varun are playing a series of games. Each of them contributes Rs 1000 to start. Varun's chance of winning an individual game is 3 times that of Sandeep's. They make an agreement that whoever wins 5 games first can take the entire money with him. After first 3 games, Varun has won 1 game and Sandeep has won 2 games. Now they are bored and do not want to play further.
So they want to divide the money on the basis of the result of first 3 games.
Let x be the money Varun gets and y be the money Sandeep gets. Find x^y. If x and y are not integers, round them to nearest integer. Since answer can be very large, enter the answer modulo 10^9+7.