Problem:
Score: 400 points

Problem Statement

Amidakuji is a traditional method of lottery in Japan.

To make an amidakuji, we first draw W parallel vertical lines, and then draw horizontal lines that connect them. The length of each vertical line is H+1 [cm], and the endpoints of the horizontal lines must be at 1, 2, 3, ..., or H [cm] from the top of a vertical line.

A valid amidakuji is an amidakuji that satisfies the following conditions:

No two horizontal lines share an endpoint.

The two endpoints of each horizontal lines must be at the same height.

A horizontal line must connect adjacent vertical lines.

Find the number of the valid amidakuji that satisfy the following condition, modulo 1\ 000\ 000\ 007: if we trace the path from the top of the leftmost vertical line to the bottom, always following horizontal lines when we encounter them, we reach the bottom of the K-th vertical line from the left.

For example, in the following amidakuji, we will reach the bottom of the fourth vertical line from the left.

Constraints

H is an integer between 1 and 100 (inclusive).

W is an integer between 1 and 8 (inclusive).

K is an integer between 1 and W (inclusive).

Input

Input is given from Standard Input in the following format:

H W K

Output

Print the number of the amidakuji that satisfy the condition, modulo 1\ 000\ 000\ 007.

Sample Input 1

1 3 2

Sample Output 1

1

Only the following one amidakuji satisfies the condition:

Sample Input 2

1 3 1

Sample Output 2

2

Only the following two amidakuji satisfy the condition:

Sample Input 3

2 3 3

Sample Output 3

1

Only the following one amidakuji satisfies the condition:

Sample Input 4

2 3 1

Sample Output 4

5

Only the following five amidakuji satisfy the condition:

Sample Input 5

7 1 1

Sample Output 5

1

As there is only one vertical line, we cannot draw any horizontal lines. Thus, there is only one amidakuji that satisfies the condition: the amidakuji with no horizontal lines.

Sample Input 6

15 8 5

Sample Output 6

437760187

Be sure to print the answer modulo 1\ 000\ 000\ 007.

Solution in C# (Mono 4.6.2.0) (judge verdict: Accepted)

using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Numerics;
using System.Text;
using System.Threading.Tasks;

namespace AtCorder
{
	public class Program
	{
		static void Main(string[] args)
		{
			var cin = new Scanner2();
			int h = cin.Int();
			int w = cin.Int();
			int k = cin.Int();

			if (k - 1 > h) {
				Console.WriteLine(0);
				return;
			}

			var fib = new ModInt[9] {1, 1, 2, 3, 5, 8, 13, 21, 34 };

			var dp = new ModInt[h + 1, w];
			dp[0, 0] = 1;

			for (int i = 1; i < h + 1; i++) {
				for (int j = 0; j < w; j++) {
					if (j == 0) {
						dp[i, j] += dp[i - 1, j] * fib[Math.Max(w - 1, 0)];
						if (j + 1 < w) {
							dp[i, j + 1] += dp[i - 1, j] * fib[Math.Max(w - 2, 0)];
						}
					} else if (j == w - 1) {
						dp[i, j] += dp[i - 1, j] * fib[Math.Max(w - 1, 0)];
						dp[i, j - 1] += dp[i - 1, j] * fib[Math.Max(w - 2, 0)];
					} else {
						//そのまま
						dp[i, j] += dp[i - 1, j] 
							* fib[Math.Max(j, 0)]
							* fib[Math.Max(w - 1 - j, 0)];
						//左
						dp[i, j - 1] += dp[i - 1, j]
							* fib[Math.Max(j - 1, 0)]
							* fib[Math.Max(w - 1 - j, 0)];
						//右
						dp[i, j + 1] += dp[i - 1, j]
							* fib[Math.Max(j, 0)]
							* fib[Math.Max(w - 1 - j - 1, 0)];
					}
				}
			}

			long ans = dp[h, k - 1].Value;
			Console.WriteLine(ans);
		}
	}

	public struct ModInt
	{
		public static long Mod { get; set; } = (long)1e9 + 7;

		public static ModInt Pow(ModInt value, long k)
		{
			return Pow(value.Value, k);
		}

		public static ModInt Pow(long value, long k)
		{
			long ret = 1;
			for (k %= Mod - 1; k > 0; k >>= 1, value = value * value % Mod) {
				if ((k & 1) == 1) {
					ret = ret * value % Mod;
				}
			}
			return new ModInt(ret);
		}

		public static ModInt Inverse(ModInt value)
		{
			return Pow(value, Mod - 2);
		}

		public long Value;

		public ModInt(long value)
		{
			value %= Mod;
			if (value < 0) {
				value += Mod;
			}

			Value = value;
		}

		public static ModInt operator +(ModInt lhs, ModInt rhs)
		{
			lhs.Value += rhs.Value;
			if (lhs.Value >= Mod) {
				lhs.Value -= Mod;
			}
			return lhs;
		}

		public static ModInt operator -(ModInt lhs, ModInt rhs)
		{
			lhs.Value -= rhs.Value;
			if (lhs.Value < 0) {
				lhs.Value += Mod;
			}

			return lhs;
		}

		public static ModInt operator *(ModInt lhs, ModInt rhs)
		{
			return new ModInt(lhs.Value * rhs.Value % Mod);
		}
		public static ModInt operator /(ModInt lhs, ModInt rhs)
		{
			long exp = Mod - 2;
			while (exp > 0) {
				if (exp % 2 > 0) {
					lhs *= rhs;
				}

				rhs *= rhs;
				exp /= 2;
			}

			return lhs;
		}

		public static implicit operator ModInt(long n)
		{
			n %= Mod;
			if (n < 0) {
				n += Mod;
			}

			return new ModInt(n);
		}

		public override string ToString()
		{
			return Value.ToString();
		}
	}

	public static class ModCounting
	{
		private static long p_;

		private static long[] factorial_;
		private static long[] inverseFactorial_;
		private static long[] inverse_;

		public static void InitializeFactorial(long max, long p = 1000000007)
		{
			p_ = p;

			factorial_ = new long[max + 1];
			inverseFactorial_ = new long[max + 1];
			inverse_ = new long[max + 1];

			factorial_[0] = factorial_[1] = 1;
			inverseFactorial_[0] = inverseFactorial_[1] = 1;
			inverse_[1] = 1;
			for (int i = 2; i <= max; i++) {
				factorial_[i] = factorial_[i - 1] * i % p;
				inverse_[i] = p - inverse_[p % i] * (p / i) % p;
				inverseFactorial_[i] = inverseFactorial_[i - 1] * inverse_[i] % p;
			}
		}

		public static long Factorial(long n)
		{
			if (n < 0) {
				return 0;
			}

			return factorial_[n];
		}

		public static long InverseFactorial(long n)
		{
			if (n < 0) {
				return 0;
			}

			return inverseFactorial_[n];
		}

		public static long Inverse(long n)
		{
			if (n < 0) {
				return 0;
			}

			return inverse_[n];
		}

		public static long Permutation(long n, long k)
		{
			if (n < k || (n < 0 || k < 0)) {
				return 0;
			}

			return factorial_[n] * inverseFactorial_[n - k] % p_;
		}

		public static long RepeatedPermutation(long n, long k)
		{
			long ret = 1;
			for (k %= p_ - 1; k > 0; k >>= 1, n = n * n % p_) {
				if ((k & 1) == 1) {
					ret = ret * n % p_;
				}
			}

			return ret;
		}

		public static long Combination(long n, long k)
		{
			if (n < k || (n < 0 || k < 0)) {
				return 0;
			}

			return factorial_[n] * (inverseFactorial_[k] * inverseFactorial_[n - k] % p_) % p_;
		}

		public static long HomogeneousProduct(long n, long k)
		{
			if (n < 0 || k < 0) {
				return 0;
			}

			return Combination(n + k - 1, k);
		}
	}
	public class Scanner2
	{
		private readonly char[] delimiter_ = new char[] { ' ' };
		private readonly string filePath_;
		private readonly Func<string> reader_;
		private string[] buf_;
		private int index_;

		public Scanner2(string file = "")
		{
			if (string.IsNullOrWhiteSpace(file)) {
				reader_ = Console.ReadLine;
			} else {
				filePath_ = file;
				var fs = new StreamReader(file);
				reader_ = fs.ReadLine;
			}
			buf_ = new string[0];
			index_ = 0;
		}

		public string Next()
		{
			if (index_ < buf_.Length) {
				return buf_[index_++];
			}

			string st = reader_();
			while (st == "") {
				st = reader_();
			}

			buf_ = st.Split(delimiter_, StringSplitOptions.RemoveEmptyEntries);
			if (buf_.Length == 0) {
				return Next();
			}

			index_ = 0;
			return buf_[index_++];
		}

		public int Int() => int.Parse(Next());
		public long Long() => long.Parse(Next());
		public double Double() => double.Parse(Next());

		public int[] ArrayInt(int N, int add = 0)
		{
			int[] Array = new int[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Int() + add;
			}
			return Array;
		}

		public long[] ArrayLong(int N, long add = 0)
		{
			long[] Array = new long[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Long() + add;
			}
			return Array;
		}

		public double[] ArrayDouble(int N, double add = 0)
		{
			double[] Array = new double[N];
			for (int i = 0; i < N; i++) {
				Array[i] = Double() + add;
			}
			return Array;
		}

		public void Save(string text)
		{
			if (string.IsNullOrWhiteSpace(filePath_)) {
				return;
			}

			File.WriteAllText(filePath_ + "_output.txt", text);
		}
	}
}