xay loves nim
时间限制:C/C++/Rust/Pascal 2秒,其他语言4秒
空间限制:C/C++/Rust/Pascal 512 M,其他语言1024 M
64bit IO Format: %lld

题目描述

Xay and Zz like playing games very much. One day Xay comes up with a good idea.

There are n piles of stones and m magic numbers. The number of stones in the i-th pile can be any positive integer from l_i to r_i.

Xay and Zz take turns removing stones. Xay goes first. Each player can choose a pile, and take any positive integer number of stones from it, and the number of stones taken x must satisfy or x is a magic number, where  stands for the Mobius function. The first player who can't make a move loses the game.

Xay wants to know in how many of the possible starting situations will he win. This number may be very large. You only need to output it modulo .

输入描述:

The first line of input contains two integers n and m(, ).

Each of the next n lines contain two integers l_i,r_i ( ) — Indicates the range of the number of stones in the i-th pile.

The next line contains m magic number x_i).

输出描述:

Print a single integer, represents the number of first-hand winning plans modulo .
示例1

输入

复制
2 0
2 2
3 3

输出

复制
1
示例2

输入

复制
5 2
1 111
2 222
3 333
4 444
5 555
3 7

输出

复制
703369008