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: Wrong Answer)

using System;
using System.Text;
using System.Collections.Generic;
using static System.Math;
using System.Linq;
using static System.Array;
using System.Runtime.Serialization.Formatters.Binary;
using System.IO;

namespace AtcoderExpress
{


    class Program2
    {
        static long mod = 1000000007;
        static long[,] stic;
        static void Main(string[] args)
        {
            var HWK = Console.ReadLine().Split(' ').Select(x => int.Parse(x)).ToArray();
            var H = HWK[0];
            var W = HWK[1];
            var K = HWK[2];
            

            stic = new long[W+1,2];
            stic[1, 0] = 1;
            stic[1, 1] = 1;
            var num = new long[H + 1, W + 1];
            num[0, 1] = 1;
            culstic(W, 0);
            culstic(W, 1);

            for (int i = 1; i <= H; i++)
            {
                for (int j = 1; j <= W; j++)
                {
                    if (j == 1)
                    {
                        num[i, j] = num[i - 1, j] * (culsticsum(Max(W - 2, 0)) % mod);
                        num[i, j] %= mod;
                        num[i, j] += W >= 2 ? (num[i - 1, Min(j + 1, W)] * culsticsum(Max(W - 3, 0))) % mod : 0;
                        num[i, j] %= mod;
                    }
                    else if (j == W)
                    {
                        num[i, j] = (num[i - 1, j] * culsticsum(Max(W - 2, 0))) % mod + (num[i - 1, j - 1] * culsticsum(Max(W - 3, 0))) % mod;
                        num[i, j] %= mod;
                    }
                    else
                    {
                        num[i, j] = ((num[i - 1, j] * culsticsum(Max(j-2, 0))%mod)* culsticsum(Max(W - j-1, 0))) % mod;
                        if (j == 2)
                        {
                            num[i, j] += num[i - 1, j - 1] * culsticsum(Max(W - 3, 0)) % mod;
                        }
                        else
                        {
                            num[i, j] += (num[i - 1, j - 1] * culsticsum(Max(j - 3, 0))%mod)*culsticsum(Max(W - j-1, 0)) % mod;
                        }
                        num[i, j] %= mod;

                        if (j == W - 1)
                        {
                            num[i, j] += num[i - 1, j + 1] * culsticsum(Max(W - 3, 0)) % mod;
                        }
                        else
                        {
                            num[i, j] += (num[i - 1, j + 1] * culsticsum(Max(j - 2, 0))%mod)*culsticsum(Max(W - j-2, 0)) % mod;
                        }
                        num[i, j] %= mod;
                    }
                }
            }
            Console.WriteLine(num[H, K] % mod);
        }

        static long culsticsum(int num)
        {
            if(num == 0)
            {
                return 1;
            }
            return (stic[num, 0] + stic[num, 1])%mod;
        }
        
        static long culstic(int num,int type)
        {
            
            if( stic[num,type] > 0)
            {
                return stic[num, type];
            }
            else
            {
                stic[num, type] = culstic(num-1,0)%mod;
                if(num == 0)
                {
                    stic[num, type] += culstic(num - 1, 1) % mod;
                }
            }
            return stic[num, type]%mod;
        }

        public static long RepPow(long x, long p, long m = 1000000007)
        {
            if (p == 1) return x % m;
            if (p == 0) return 1 % m;
            long b = RepPow(x, p / 2, m) % m;
            if (p % 2 == 0) { return (b * b) % m; }
            else { return (x * ((b * b) % m)) % m; }
        }
    }
}