Under construction

Still being built. Things may change

Palindromic substrings

Time limit2sMemory limit512 MB

Summary
Count length-N uppercase strings whose length-M substrings include at least K palindromes.
Level

Medium5 of 10

Topics
Brute force, String, Recursion, Bit manipulation
Solved
No attempts yet

Problem

Consider the strings of length NN made only of uppercase letters. Such a string has one substring of length MM for each starting position, N−M+1N-M+1 in total. Write a program that counts the strings for which at least KK of those substrings are palindromes. Substrings with the same content but different starting positions are counted separately.

Input

The first line contains NN, MM, and KK, separated by spaces. (2≤M≤N≤112 \le M \le N \le 11, 0≤K≤110 \le K \le 11)

Output

Print the number of strings that satisfy the condition on the first line. The answer is at most 263−12^{63}-1.

Hint

For N=2N=2, M=2M=2, K=1K=1 the qualifying strings are AA, BB, CC through ZZ, the ones whose two letters match. For K=0K=0 no palindrome is required, so every string of length NN qualifies.

Examples5

  1. Example 1

    Input
    2 2 1
    
    Expected output
    26
    
  2. Example 2

    Input
    2 2 0
    
    Expected output
    676
    
  3. Example 3

    Input
    3 2 1
    
    Expected output
    1326
    
  4. Example 4

    Input
    4 4 1
    
    Expected output
    676
    
  5. Example 5

    Input
    7 3 3
    
    Expected output
    4310176