3304 - Super Pow 3304 - Super Pow 3304 - Super Pow

Statistics Sub: 140 | AC: 17 | AC%: 12,14 | Score: 4,00
Created by Isaac Vega Rodríguez
Added by isaacvr (2015-06-03)
Limits
Total Time: 10000 MS | Test Time: 2500 MS |Memory: 256 MB | Output: 64 MB | Size: 16 KB
Enabled languages
Available in

Description

Alice and Bob was talking about factorials and Alice, like always, proposed to Bob one interesting test. She said: "I go to give you thee numbers, a, b and c, and you will do this operation: first, you will calculate a!, b! and c!, after this you will calculate b! ^ c! and then, you will take this result (called d) and will calculate a! ^ d". Bob, thinking that this operation was small and easy, started trying with a=2, b=3 and c=2, he calculated a!, b! and c! that are 2, 6 and 2. Then, he calculated 6^2 = 36, but when he was trying to calculate 2^36, he realized that was very big this number, so he want your help to find this result.
Alice and Bob was talking about factorials and Alice, like always, proposed to Bob one interesting test. She said: "I go to give you thee numbers, a, b and c, and you will do this operation: first, you will calculate a!, b! and c!, after this you will calculate b! ^ c! and then, you will take this result (called d) and will calculate a! ^ d". Bob, thinking that this operation was small and easy, started trying with a=2, b=3 and c=2, he calculated a!, b! and c! that are 2, 6 and 2. Then, he calculated 6^2 = 36, but when he was trying to calculate 2^36, he realized that was very big this number, so he want your help to find this result.
Alice and Bob was talking about factorials and Alice, like always, proposed to Bob one interesting test. She said: "I go to give you thee numbers, a, b and c, and you will do this operation: first, you will calculate a!, b! and c!, after this you will calculate b! ^ c! and then, you will take this result (called d) and will calculate a! ^ d". Bob, thinking that this operation was small and easy, started trying with a=2, b=3 and c=2, he calculated a!, b! and c! that are 2, 6 and 2. Then, he calculated 6^2 = 36, but when he was trying to calculate 2^36, he realized that was very big this number, so he want your help to find this result.

Input specification

The first line contain a single number t that is the test cases (1 <= t <= 10^5). The next t lines contain three numbers, a, b and c, separated by a single space (0 <= a, b, c <= 10^6).
The first line contain a single number t that is the test cases (1 <= t <= 10^5). The next t lines contain three numbers, a, b and c, separated by a single space (0 <= a, b, c <= 10^6).
The first line contain a single number t that is the test cases (1 <= t <= 10^5). The next t lines contain three numbers, a, b and c, separated by a single space (0 <= a, b, c <= 10^6).

Output specification

For each test in the input, you will give the result of the operation described above modulo 1000000007.
For each test in the input, you will give the result of the operation described above modulo 1000000007.
The first line contain a single number t that is the test cases (1 <= t <= 10^5). The next t lines contain three numbers, a, b and c, separated by a single space (0 <= a, b, c <= 10^6).

Sample input

1
2 3 2

Sample output

719476260

Hint(s)

The operation, mathematically speaking is a! ^ ( b! ^ c! ).
The operation, mathematically speaking is a! ^ ( b! ^ c! ).
The operation, mathematically speaking is a! ^ ( b! ^ c! ).

Recommendation

We have carefully selected several similar problems: 3378 | 3377 | 2156 | 2243 | 3479 | 1811