题库练习 GukiZ and Binary Operations
← 上一题 下一题 →

A9911 | GukiZ and Binary Operations

时间限制1s
内存限制256MB
通过 / 提交0/0

题目描述

We all know that GukiZ often plays with arrays.

Now he is thinking about this problem: how many arrays $a$ , of length $n$ , with non-negative elements strictly less then $2^{l}$ meet the following condition: ![](/uploads/luogu/CF551D/a6e7bc576316f94114c2b7ddad7b1f99dc329174_318c84a0569a.png)? Here operation ![](/uploads/luogu/CF551D/620e07dca4a112648a0a9f81b5fb9f226c4bb233_8c3d39188ea9.png) means bitwise AND (in Pascal it is equivalent to and, in C/C++/Java/Python it is equivalent to &), operation ![](/uploads/acgo/image/6c4bc97c4534b597_88304550daf9.jpeg) means bitwise OR (in Pascal it is equivalent to ![](/uploads/acgo/image/6c4bc97c4534b597_88304550daf9.jpeg), in C/C++/Java/Python it is equivalent to |).

Because the answer can be quite large, calculate it modulo $m$ . This time GukiZ hasn't come up with solution, and needs you to help him!

输入格式

First and the only line of input contains four integers $n$ , $k$ , $l$ , $m$ ( $2<=n<=10^{18}$ , $0<=k<=10^{18}$ , $0<=l<=64$ , $1<=m<=10^{9}+7$ ).

输出格式

In the single line print the number of arrays satisfying the condition above modulo $m$ .

输入输出样例

输入 #1
2 1 2 10
输出 #1
3
输入 #2
2 1 1 3
输出 #2
1
输入 #3
3 3 2 10
输出 #3
9
C++ 编辑器
输入
输出