The concert band is playing spooky songs for Halloween!
A song can be represented as an array of elements. A sample of is a subarray with bounds of .
A spooky pair is a pair in a sample such that is a multiple of four.
Aaron happens to be one of the best band players, but is deathly afraid of spooky pairs. To overcome this fear, he will practice samples.
For each sample, he wants you to determine the number of spooky pairs in order to not get jumpscared while playing. Can you help him?
Constraints
Subtask 1 [15%]
is a multiple of four.
Subtask 2 [85%]
No additional constraints.
Input Specification
The first line of input will contain integers and .
The next line will contain integers .
The next lines will contain integers and , the bounds for the sample.
Fast IO is recommended as input can get quite large. Python users should submit in PyPy.
Output Specification
For each of the samples output the number of spooky pairs in the sample on a new line.
Sample Input 1
4 2
4 8 4 12
2 4
2 2
Sample Output 1
3
0
Explanation for Sample Output 1
, , and are spooky pairs in the first sample.
There are no spooky pairs in the second sample.
This sample input conforms to subtask .
Sample Input 2
5 3
1 3 5 7 7
1 5
4 5
1 3
Sample Output 2
4
1
1
Comments