Semafor | 프로그래밍의 벗 PivotOJ
PivotOJ

Semafor

시간 제한: 4000ms메모리 제한: 512MB출처: CHC 2020 Croatian Olympiad in InformaticsBOJ 20050
이 문제는 본문 이미지 일부가 표시되지 않습니다. 텍스트만으로 풀이가 어려울 수 있습니다.

문제

You are most likely familiar with a so-called 7-segment display which is widely used to depict digits on various digital devices, such as watches or calculators. Due to its simplicity, intuitiveness and aestheticism, this design has been accepted across the globe. Still, young Matej argues against the 7-segment design and claims that the same functionality can be obtained more efficiently, using only 5 segments.

[이미지 1]

5-segment display design – segments are labeled with letters from a to e.

Matej decided to make his first entrepreneurial steps in the most prosperous branch of Croatian economy, football. His revolutionary design will be used on a substitution board during the games of 1. HNL.1 He is currently making a presentation for the board of directors at the Croatian Football Association.

The substitution board consists of M 5-segment displays which, from left to right, represent the digits of a jersey number worn by the player that is about to leave the pitch. At the beginning of Matej’s presentation, the substitution board represents the number X, and Matej will make one of the following moves each second:

  • Turn on one segment that is currently turned off.
  • Turn off one segment that is currently turned on.

In total, Matej will make N moves and he will make sure that after each K-th move, the board shows a valid number. The number is valid if each of its digits is correctly shown on the corresponding display (i.e. segments that are turned on show a valid digit). Also, numbers having less than M digits are validly shown if they contain the appropriate number of leading zeros.

For each final state (integer between 0 and 10M − 1), Matej is interested in how many different ways could he make his moves during the presentation such that this final state is reached at the end. Of course, he needs to adhere to all limitations presented in the previous chapters. We consider two sequences of moves different if, imagining they are executed on two different boards at the same time, there is a moment at which the two boards represent a different state.

Since the number of different ways can be quite large, you are asked to compute it modulo 109 + 7.

1The elite tier of Croatian professional football.

입력

The first line contains integers M, N, K (1 ≤ K ≤ N) and X (0 ≤ X < 10M) from the task description.

출력

In the i-th line you should output the number of different ways for the substitution board to show the number i − 1 at the end of Matej’s presentations. The numbers should be printed modulo 109 + 7.

예제

예제 1

입력
1 2 1 5
출력
0
0
0
1
0
2
0
0
0
0

예제 2

입력
1 3 3 8
출력
0
0
0
6
0
13
0
0
0
0

예제 3

입력
1 4 2 4
출력
24
0
8
0
37
0
4
28
4
24
코드를 제출하려면 로그인하세요.