题号:NC53383
时间限制:C/C++/Rust/Pascal 1秒,其他语言2秒
空间限制:C/C++/Rust/Pascal 32 M,其他语言64 M
Special Judge, 64bit IO Format: %lld
题目描述
Bobo has a decimal integer

, possibly with leading zeros. He knows that for m ranges

, it holds that

.
Find the number of valid integers

, modulo
)
.
输入描述:
The input consists of several test cases and is terminated by end-of-file.
The first line of each test case contains two integers n and m.
The ith of the following m lines contains two integers
and
.
* 
* 
* There are at most 100 test cases.
输出描述:
For each test case, print an integer which denotes the result.
示例1
输入
复制
2 1
1 2
4 2
1 3
2 4
50 1
1 50