This is another exercise about Fermat’s last theorem, which was explained in the exercise problem://problemsjutge.org:problems/p1/roura/fermat-1.pbm
Write a program that, given four natural numbers with and , prints the number of solutions to the equation such that and .
Input has several cases. Each case consists of four natural numbers such that and .
For every case, print in a line the number of solutions to the equation that fulfill and .
Input
2 5 4 13 1 1 2 3
Output
2 0