题号:NC239325
时间限制:C/C++/Rust/Pascal 6秒,其他语言12秒
空间限制:C/C++/Rust/Pascal 256 M,其他语言512 M
64bit IO Format: %lld
题目描述
Groudon wanna fly. Kyogre will tell Groudon how to fly if and only if Groudon solves the following problem.
There are

integers

, one integer

and

integer pairs
%2C%20(b_2%2Cc_2)%2C%20%5Cldots%2C%20(b_k%2Cc_k))
. You need to find the number of non-negative

-tuples
)
which satisfies:
Here,

denotes the bitwise operation AND.
Two non-negative

-tuples
)
and
)
are considered different if and only if there exists one integer

which satisfies

.
Since the answer is too large, Kyogre only wants to know it modulo

.
You, as a programmer of Hoenn, please help Groudon!
输入描述:
The first line contains three integers

(

).
The second line contains

integers

(

).
For the

-th line in the following

lines, there are two integers

(

).
All numbers in the input denote the parameter of Kyogre's problem.
输出描述:
Print a single integer, denoting the answer to Kyogre's problem, modulo
.
示例2
输入
复制
6 10 2
1 1 4 5 1 4
3 1
4 2
备注:
In the first example, there are
non-negative
-tuples satisfy the condition in Kyogre's problem:
,
,
,
.