Life of Phi II

Limits 1s, 512 MB

You will be given two integers nn and mm where GCD(n,m)=1GCD(n, m) = 1. You have to tell that how many numbers are there from 11 to m×nm×n that is co-prime to:

  1. nn but not with mm,
  2. mm but not with nn, and
  3. both mm and nn.


The only line of input contains two integers nn and mm (1n,m1061 ≤ n, m ≤ 10^6). It is guaranteed that nn and mm are relatively prime.


Output three numbers as mentioned above.


2 3
1 2 2
5 7
4 6 24

Please note that for relatively prime numbers nn and mm, Phi(n×m)=Phi(n)×Phi(m)Phi(n×m) = Phi(n)×Phi(m).