Cow Hopscotch

No attempts yetTime limit1sMemory limit256 MB

Problem

People enjoy playing hopscotch, and Farmer John's cows have invented a variant for themselves. Clumsy animals weighing nearly a ton play it, so cow hopscotch almost always ends in disaster. The cows still set the board up nearly every afternoon.

The board is an R×CR \times C grid (2R1002 \le R \le 100, 2C1002 \le C \le 100). Each square holds one integer between 11 and KK (1KR×C1 \le K \le R \times C). A cow starts on the top-left square and reaches the bottom-right square with a sequence of jumps. A jump is valid only when all three of these conditions hold.

  1. The integer on the destination square differs from the integer on the current square.
  2. The destination square is at least one row below the current square.
  3. The destination square is at least one column to the right of the current square.

Count the different sequences of valid jumps that take a cow from the top-left square to the bottom-right square.

Input

The first line contains the integers RR, CC, and KK.

Each of the next RR lines contains CC integers. All of them are between 11 and KK.

Output

Print on one line the number of different ways to get from the top-left square to the bottom-right square, modulo 10000000071000000007.