Is This FFT?
You are given two arrays and of lengths and respectively.
Let real number be a root of an equation if the equation holds for it. Calculate the number of roots for the following equation or determine if it has infinitely many roots:
Here denotes the absolute value of a number, i.e., if and if .
Input
The first line of the input contains two integers and (; ).
The second line contains integers .
The third line contains integers .
Output
In the only line, you need to output the number of roots for the given equation, or "Infinity
" if there are infinitely many roots.
Examples
Note
In the first test case, the equation is , which holds for any .
In the second test, the equation is
The root for this equation is :
It can be proved that this equation does not have other roots.
In the third test, the equation is
The are 3 roots for this equation: . Notice that roots can be not only integers.
It can be proved that this equation does not have other roots.
Scoring
( points): ; ;
( points): ;
( points): ; ;
( points): ;
( points): no additional constraints.