시간 제한 메모리 제한 제출 정답 맞은 사람 정답 비율
1 초 128 MB 10 6 3 75.000%


The residents of a remote Himalayan monastery believe that strings of repeated syllables in their language have mystic power, particularly if they can produce chants containing all possible strings of a given length. Because outsiders are not even allowed to know the syllables, they have replaced them with single characters such that the resulting strings can be converted into chants easily. They have developed the following rules.

  1. there are only two characters ‘*’ and ‘!’.
  2. In any given situation there is a fixed length of word.
  3. To impose some structure on the sequences there can never be more than some number of each character in succession.
  4. For completeness, we need all the possible sequences of characters that will match these rules.

Write a program that will read in the length of the sequence and the maximum number of adjacent ‘*’s and ‘!’s and produce all acceptable sequences. These should be in lexicographic sequence, where, for this problem, ‘*’ is deemed to precede ‘!’.


Input consists of sequence of lines each containing 3 integers: n (1 ≤ n ≤ 10), nstar and nbang, and is terminated by a line containing 3 zeroes (0 0 0).


Output consists of, for each problem in the set, a header line starting with ‘Sequence set ‘, followed by a running number starting at 1, followed by the ordered list of such sequences, i.e. those with no more than nstar consecutive ‘*’s and no more than nbang consecutive ‘!’s, one per line, followed by a blank line.

예제 입력 1

1 1 1
3 0 0
2 10 1
0 0 0

예제 출력 1

Sequence set 1
Sequence set 2
Sequence set 3