Codeforces Round 447 (Div. 2)
B
Ralph And His Magic Field
Codeforces
1800
原题
← AC →
翻译中…

Ralph has a magic field which is divided into $*n* × *m*$ blocks. That is to say, there are $*n*$ rows and $*m*$ columns on the field. Ralph can put an integer in each block. However, the magic field doesn't always work properly. It works only if the product of integers in each row and each column equals to $*k*$, where $*k*$ is either 1 or -1.

翻译中…

Now Ralph wants you to figure out the number of ways to put numbers in each block in such a way that the magic field works properly. Two ways are considered different if and only if there exists at least one block where the numbers in the first way and in the second way are different. You are asked to output the answer modulo $1000000007 = 10^{9} + 7$.

翻译中…

Note that there is no range of the numbers to put in the blocks, but we can prove that the answer is not infinity.

翻译中…

Input

翻译中…

The only line contains three integers $*n*$, $*m*$ and $*k*$ ($1 ≤ *n*, *m* ≤ 10^{18}$, $*k*$ is either 1 or -1).

翻译中…

Output

翻译中…

Print a single number denoting the answer modulo $1000000007$.

翻译中…

Note

翻译中…

In the first example the only way is to put -1 into the only block.

翻译中…

In the second example the only way is to put 1 into every block.

翻译中…

样例

Input #1
1 1 -1
Output #1
1
InputCopy OutputCopy
Input #2
1 3 1
Output #2
1
InputCopy OutputCopy
Input #3
3 3 -1
Output #3
16
InputCopy OutputCopy
题目信息
题号
894B
时间限制
1 s
内存限制
256 MB
标签
组合数学
构造
数学
数论

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。