The residents of Bytelon decided to power their homes with wind energy, so they built a row of windmills.
Only one road runs through Bytelon. Every home stands in a straight line on one side of that road, and the windmills stand in a straight line on the opposite side. Some windmills are joined to some homes by high-voltage lines that run across the road. A single windmill may be joined to several homes, a single home may be joined to several windmills, and some windmills or homes may be joined to nothing at all. Every line is a straight segment, and for any (home, windmill) pair there is at most one line.
The government prefers a tidier arrangement. It wants to keep only some of the existing lines so that both of the following hold.
Count how many subsets of the existing lines satisfy both conditions. The empty subset, which keeps no line at all, counts as one valid arrangement.
Because the count can be enormous, output it modulo a number r chosen by the government.
Write a program that reads the existing lines from standard input and writes to standard output the number of valid subsets modulo r.
The first line contains four integers n, m, k, and r separated by single spaces.
Each of the next k lines contains two integers hi and wi (1≤hi≤n, 1≤wi≤m), meaning the i-th line joins home hi with windmill wi. No (home, windmill) pair appears more than once.
Print a single integer on one line: the number of valid subsets of the existing lines, taken modulo r.

For the configuration in the picture there is exactly 1 way to keep no line, 5 ways to keep a single line, 2 ways to keep two lines, and no way to keep three lines, for a total of 8.
Two kept lines cross exactly when one starts at a lower-numbered home yet ends at a higher-numbered windmill than the other. So a valid subset is a set of lines whose home indices and windmill indices increase together.