Birthday Problem
题号:NC17485
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
Special Judge, 64bit IO Format: %lld

题目描述

In a strange kingdom, there are N months in one year and there are M days in one month. A day in a year of the Kingdom can be represented by a pair (x, y) where 1 ≤ x ≤ N denotes the month and 1 ≤ y ≤ M denotes the day.

A nonempty set of days S is given. Charlotte's birthday is one of the elements of S. Alice, Bob and David know this fact but they didn't know any other information about her birthday. Let's denote Charlotte's birthday as (cx, cy).

Charlotte tells Alice the value of cx and tells Bob the value of cy.
After that, the following exchange happened exactly L times :

Alice says that she does not know Charlotte's birthday after hearing the last statement (if any) and Bob says that he does not know Charlotte's birthday after Alice's last statement.

After the above happens L times, Alice says that she knows Charlotte's birthday (i.e. she figured out the value of cy). After hearing that, Bob says that he knows Charlotte's birthday as well (i.e. he figured out the value of cx. Note that he might also have figured out Charlotte's birthday before Alice's statement). Finally, after hearing both statements, David says that he knows Charlotte's Birthday (i.e. he figured out both values cx, cy, possibly before some statements are made).

Assume that all the people are perfect logicians and do not lie.

Among the 2NM - 1 possible nonempty sets of days S, how many of them are there such that the scenario above is possible, modulo 109 + 7?

输入描述:

The input contains three space-separated integers, N, M, L (1 ≤ N, M, L ≤ 30).

输出描述:

Output a single integer, the answer to the problem.
示例1

输入

复制
3 3 1

输出

复制
18