AT_abc466_f [ABC466F] Many Mod Calculation
题目描述
You are given integers and a length- sequence of positive integers .
For a non-negative integer , define .
Find the number of integers between and , inclusive, such that .
You are given test cases; solve each of them.
输入格式
The input is given from Standard Input in the following format:
Each test case is given in the following format:
输出格式
Output the answers for the test cases in order, separated by newlines.
输入输出样例 #1
输入 #1
4
3 7
5 2 3
9 31415
9 9 8 2 4 4 3 5 3
1 1000000000000000000
1
9 20260405
3141 5926 5358 9793 2384 6264 3383 2795 288输出 #1
4
17452
1000000000000000000
77403说明/提示
Sample Explanation 1
Consider the first test case.
For example, when , .
There are four integers between and such that : .
Constraints
- The sum of over all test cases is at most .
- All input values are integers.