CF946F.Fibonacci String Subsequences

普及/提高-

通过率:0%

AC君温馨提醒

该题目为【codeforces】题库的题目,您提交的代码将被提交至codeforces进行远程评测,并由ACGO抓取测评结果后进行展示。由于远程测评的测评机由其他平台提供,我们无法保证该服务的稳定性,若提交后无反应,请等待一段时间后再进行重试。

题目描述

You are given a binary string ss (each character of this string is either 0 or 1).

Let's denote the cost of string tt as the number of occurences of ss in tt . For example, if ss is 11 and tt is 111011, then the cost of tt is 33 .

Let's also denote the Fibonacci strings sequence as follows:

  • F(0)F(0) is 0;
  • F(1)F(1) is 1;
  • F(i)=F(i1)+F(i2)F(i)=F(i-1)+F(i-2) if i>1 , where ++ means the concatenation of two strings.

Your task is to calculate the sum of costs of all subsequences of the string F(x)F(x) . Since answer may be large, calculate it modulo 109+710^{9}+7 .

输入格式

The first line contains two integers nn and xx ( 1<=n<=1001<=n<=100 , 0<=x<=1000<=x<=100 ) — the length of ss and the index of a Fibonacci string you are interested in, respectively.

The second line contains ss — a string consisting of nn characters. Each of these characters is either 0 or 1.

输出格式

Print the only integer — the sum of costs of all subsequences of the string F(x)F(x) , taken modulo 109+710^{9}+7 .

输入输出样例

  • 输入#1

    2 4
    11
    

    输出#1

    14
    
  • 输入#2

    10 100
    1010101010
    

    输出#2

    553403224
    
首页