시간 제한메모리 제한제출정답맞힌 사람정답 비율
2 초 (추가 시간 없음) 1024 MB156685.714%

문제

For any positive integer $n$, let's define Möbius function $\mu(n)$. It has values in $\{-1, 0, 1\}$ depending on the factorization of $n$ into prime factors:

  • $\mu(x) = 1$ if $x$ is a square-free positive integer with an even number of prime factors.
  • $\mu(x) = -1$ if $x$ is a square-free positive integer with an odd number of prime factors.
  • $\mu(x) = 0$ if $x$ has is divisible by some squared prime factor.

For example, $\mu(1) = 1, \mu(2) = -1, \mu(6) = 1, \mu(12) = 0$.

You are given two arrays $a$ and $b$, consisting of positive integers.

Let $k_y$ be the number of pairs $(i, j), 1 \le i \le n, 1 \le j \le m$ such that $\mu(a_i\cdot b_j)$ is equal to $y$.

Your task is to calculate $k_{-1}$, $k_{0}$ and $k_1$.

입력

The first line of input contains two integers $n, m$ ($1 \le n, m \le 2 \cdot 10^5$) --- the sizes of arrays $a$ and $b$.

The second line contains $n$ integers $a_i$ ($1 \le a_i \le 10^6$) separated by spaces.

The third line contains $m$ integers $b_i$ ($1 \le b_i \le 10^6$) separated by spaces.

출력

Output three integers $k_{-1}, k_{0}, k_{1}$ separated by spaces in a single line, where $k_y = |\{(i, j) : \mu(a_i \cdot b_j) = y \}|$.

예제 입력 1

6 4
1 2 3 4 5 6
2 3 5 7

예제 출력 1

6 9 9