SolarPea and Inversion
时间限制:C/C++/Rust/Pascal 4秒,其他语言8秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

SolarPea thinks inversion is beautiful.

For a 01-sequence Z with length n and a constant c, SolarPea defines the rating of Z is:



PolarSea has two integer sequences X and Y with length . PolarSea likes a 01-sequence Z with length n if and only if

SolarPea wrote all 01-sequences which have length n and contain m '1's on the paper. PolarSea saw it and crossed out all sequences that he doesn't like. Now you're given c, please calculate the sum of the ratings of the remaining sequences on the paper.

Since the answer could be very large, you should output it modulo 1065977431 (a prime number).

It is guaranteed that c is generated randomly.

输入描述:

The first line contains four non-negative integers n,m,k,c.

The next k lines, each line contains two non-negative intergers X_i and .

It is guaranteed that all X_i are pairwise different.

输出描述:

Output the answer modulo 1065977431.
示例1

输入

复制
3 2 1 10
2 1

输出

复制
101

说明

There are two remaining sequences \{1, 1, 0\} and \{0, 1, 1\}.
T(\{1, 1, 0\},c)=c^2=100T(\{0, 1, 1\} ,c)=c^0=1, so the answer is 100+1=101.
示例2

输入

复制
4 2 1 10
2 1

输出

复制
10110
示例3

输入

复制
1004535809 115194 2 21658
822 1
1064 0

输出

复制
606261277