Journey through Gridland

Alice is journeying through grid land. She starts in the southwest corner at coordinate (0, 0) and must reach the northeast corner at (n, m), where n, m are positive integers indicating the northeast corner is n units to the east and m units to the north. At each step she can move one unit to the east at cost √ u, one unit to the north at cost v, or 2 units to the northeast (45°angle) at cost w for integers u, v, w. The cost of a single path is the sum of the cost of all steps taken to reach the northeast corner. Compute the sum of the cost of all possible paths that Alice can take! Input A number of of inputs (≤ 1000), each start with the integer n, m, u, v, w (1 ≤ n, m, u, v, w ≤ 1000000). Output Output the answer modulo 1000000007. Sample Input 23111 32123 Sample Output 25 278