#P6076. Chessboard Coloring

    ID: 19300 Type: Default 1000ms 256MiB

Chessboard Coloring

Chessboard Coloring

There is an ( n \times m ) chessboard divided into ( n ) rows and ( m ) columns, forming ( n \times m ) cells. You are given ( C ) different colors of paint. Each cell can either be left uncolored or painted with one of the ( C ) colors, subject to the following constraints:

  1. Every row must contain at least one painted cell.
  2. Every column must contain at least one painted cell.
  3. Each of the ( C ) colors must appear at least once on the board.

Two colorings are considered different if there exists at least one cell where the color (or painted/unpainted status) differs.

Calculate the total number of different valid coloring schemes.

inputFormat

The input consists of a single line containing three integers ( n ), ( m ), and ( C ) separated by spaces, representing the number of rows, columns, and available colors, respectively.

outputFormat

Output a single integer, representing the total number of valid coloring schemes that satisfy the given conditions.

sample

1 1 1
1