Random flips

0

0 votes
Mathematics, Medium-Hard, Probablity, Basic Probability, Probability
Problem

Consider a matrix with n rows and m columns where each cell contains a value 0. You are required to perform the following operation k times:

  • From the set of submatrices, select one submatrix at random.
  • Toggle all the values in the selected submatrix. In other words, change all cells with a value 0 to 1 and vice versa.

Determine the expected sum of the matrix after completion of all the k operations. Let this value be E=PQ. Print the value of PQ1 modulo 109+7, where Q1 denotes the modular inverse of Q modulo 109+7.

Input format

First line: Three integers n,m  and k

Output format

Print the value of PQ1 modulo 109+7.

Constraints

1n,m109

1k1000

Time Limit: 1
Memory Limit: 256
Source Limit:
Explanation

There are three submatrices in total. One submatrix is equal to the full matrix, while the other two submatrices consist of one cell each.

With a probability 23, a submatrix with one cell is chosen and we get the sum as 1.

With a probability 13, the full matrix  is chosen and we get the sum as 2.

The expected value is hence 23×1+13×2=43

31=333333336 modulo 109+7.

Thus we print 4×333333336 modulo 109+7, which is 333333337.

Editor Image

?