#P5952. Water Tank Possibilities
Water Tank Possibilities
Water Tank Possibilities
In a water tank, its top view is divided into \(n\) rows and \(m\) columns of square cells, with walls between adjacent cells. A wall of infinite height surrounds the tank, so water cannot leak out. Each cell in the tank can have a water level which is an integer in the range \([0, H]\). Two configurations are considered different if at least one cell has a different water level.
Count the number of possible water level configurations in the tank. Since the result can be very large, output the answer modulo \(10^9+7\).
The mathematical formulation is to compute: \[ \text{answer} = (H+1)^{n\times m} \mod (10^9+7) \]
inputFormat
The input consists of a single line containing three space-separated integers \(n\), \(m\), and \(H\) (\(0 \leq H\)).
outputFormat
Output a single integer representing the number of possible water level configurations modulo \(10^9+7\).
sample
1 1 0
1