Möbius

아직 제출이 없습니다시간 제한2초메모리 제한1024 MB

문제

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

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

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

You are given two arrays aa and bb, consisting of positive integers.

Let k_yk\_y be the number of pairs (i,j),1in,1jm(i, j), 1 \le i \le n, 1 \le j \le m such that μ(a_ib_j)\mu(a\_i\cdot b\_j) is equal to yy.

Your task is to calculate k_1k\_{-1}, k_0k\_{0} and k_1k\_1.

입력

The first line of input contains two integers n,mn, m (1n,m21051 \le n, m \le 2 \cdot 10^5) --- the sizes of arrays aa and bb.

The second line contains nn integers a_ia\_i (1a_i1061 \le a\_i \le 10^6) separated by spaces.

The third line contains mm integers b_ib\_i (1b_i1061 \le b\_i \le 10^6) separated by spaces.

출력

Output three integers k_1,k_0,k_1k\_{-1}, k\_{0}, k\_{1} separated by spaces in a single line, where k_y=(i,j):μ(a_ib_j)=yk\_y = |\\{(i, j) : \mu(a\_i \cdot b\_j) = y \\}|.