P3120 [USACO15FEB] Cow Hopscotch G

Description

Just like humans enjoy playing the game of Hopscotch, Farmer John's cows have invented a variant of the game for themselves to play. Being played by clumsy animals weighing nearly a ton, Cow Hopscotch almost always ends in disaster, but this has surprisingly not deterred the cows from attempting to play nearly every afternoon. The game is played on an R by C grid (2

Input Format

The first line contains the integers R, C, and K. The next R lines will each contain C integers, each in the range 1..K.

Output Format

Output the number of different ways one can jump from the top-left square to the bottom-right square, mod 1000000007.