Codeforces Round 156 (Div. 1)
D
Liars and Serge
Codeforces
2700
原题
← CE →
翻译中…

There are $*n*$ people, sitting in a line at the table. For each person we know that he always tells either the truth or lies.

翻译中…

Little Serge asked them: how many of you always tell the truth? Each of the people at the table knows everything (who is an honest person and who is a liar) about all the people at the table. The honest people are going to say the correct answer, the liars are going to say any integer from 1 to $*n*$, which is not the correct answer. Every liar chooses his answer, regardless of the other liars, so two distinct liars may give distinct answer.

翻译中…

Serge does not know any information about the people besides their answers to his question. He took a piece of paper and wrote $*n*$ integers $*a*_{1}, *a*_{2}, ..., *a*_{*n*}$, where $*a*_{*i*}$ is the answer of the $*i*$-th person in the row. Given this sequence, Serge determined that exactly $*k*$ people sitting at the table apparently lie.

翻译中…

Serge wonders, how many variants of people's answers (sequences of answers $*a*$ of length $*n*$) there are where one can say that exactly $*k*$ people sitting at the table apparently lie. As there can be rather many described variants of answers, count the remainder of dividing the number of the variants by $777777777$.

翻译中…

Input

翻译中…

The first line contains two integers $*n*$, $*k*$, $(1 ≤ *k* ≤ *n* ≤ 2^{8})$. It is guaranteed that $*n*$ — is the power of number 2.

翻译中…

Output

翻译中…

Print a single integer — the answer to the problem modulo $777777777$.

翻译中…

样例

Input #1
1 1
Output #1
0
InputCopy OutputCopy
Input #2
2 1
Output #2
2
InputCopy OutputCopy
题目信息
题号
256D
时间限制
1 s
内存限制
256 MB
标签
动态规划

题面与样例版权归 Codeforces 及出题人所有;中文翻译由 AI 生成(CI 管线),如有出入请以原文为准。