Is This FFT?#11678

Is This FFT?

2 seconds
256 megabytes
Hard

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:

|x-a_1| + |x-a_2| + |x-a_3| + \ldots + |x-a_n| = |x-b_1| + |x-b_2| + |x-b_3| + \ldots +|x-b_m|

Here denotes the absolute value of a number, i.e., |a| = a if a \geq 0 and |a| = -a if a < 0.

Input

The first line of the input contains two integers and (1 \leq n \leq 2 \cdot 10^5; 1 \leq m \leq 2 \cdot 10^5).

The second line contains integers a_1, a_2, \dots, a_n (|a_i| \leq 10^9).

The third line contains integers b_1, b_2, \dots, b_m (|b_i| \leq 10^9).

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

Example 1

Loading
Loading

Example 2

Loading
Loading

Example 3

Loading
Loading

Note

In the first test case, the equation is |x-1| = |x-1|, which holds for any .

In the second test, the equation is

|x| + |x-5| + |x-8| = |x-3| + |x-8| + |x-14| \implies |x| + |x-5| = |x-3| + |x-14|

The root for this equation is x = 8:

|8| + |8-5| = 8 + |3| = 11
|8-3| + |8-14| = |5| + |-6| = 5 + 6 = 11

It can be proved that this equation does not have other roots.

In the third test, the equation is

|x-5| + |x-6| + |x+4| + |x-10| = |x-7| + |x+8| + |x-8|

There are 3 roots for this equation: x = 2, x = 6\frac{2}{3}, x = 10. Notice that roots can be not only integers.

It can be proved that this equation does not have other roots.

Scoring

  1. ( points): n = m; a_i = b_i (1 \leq i \leq n);

  2. ( points): n = m = 1;

  3. ( points): |a_i| \leq 20 (1 \leq i \leq n); |b_i| \leq 20 (1 \leq i \leq m);

  4. ( points): n, m \leq 1\,000;

  5. ( points): no additional constraints.