require'matrix'
eval'H,W,K='+`dd`.split*?,
f=1,1,2,3,5,8,13,21
A=Matrix[
	*(1..W).map{|i|
		(1..W).map{|j|
			if i==j
				f[i-1]*f[W-i]
			elsif i+1==j
				f[i-1]*f[W-j]
			elsif i==j+1
				f[i-2]*f[W-i]
			else
				0
			end
		}
	}
]
p (A**H)[0,K-1].%10**9+7