P23626 [AtCoder] Magic Square
省选
题目描述

Problem Description

Takahashi loves magic squares.

A magic square is a $3$ grid × 3 grid filled with distinct positive integers such that the sum of the three integers in each row, column, and diagonal is equal.

Takahashi wondered if it would be possible to create a "multiplicative version of a magic square" where instead of the sum, the product of the three integers in each row, column, and diagonal is equal.

After some exploration, he managed to create one such multiplicative magic square as shown in the figure below.

The product of all rows, columns, and diagonals is $1000$.

Now, Takahashi is curious about how many types of multiplicative magic squares exist where the center cell is $N$.

Here, two magic squares that can be transformed into each other by $90$ degree rotations or horizontal/vertical reflections are considered the same.

Please help Takahashi find the number of types of multiplicative magic squares where the center cell is $N$.

Input Format

The input is given from the standard input in the following format:

$ N $

  • The first line contains the value of the center cell $N\ (1\ ≦\ N\ ≦\ 10^{12})$ of the multiplicative magic square.

Output Format

Output the number of types of multiplicative magic squares where the center cell is $ N $ in one line. Include a newline at the end of the output.

Sample Input and Output

Sample Input #1

16

Sample Output #1

1

Sample Input #2

10

Sample Output #2

1

Sample Input #3

9

Sample Output #3

0

Sample Input #4

90

Sample Output #4

29

Notes/Hints

Sample Explanation 1

The following pattern is not a magic square because the integers are duplicated. The following patterns can all be transformed into the same one by rotations or reflections.

输入格式

见题面 Input 部分

输出格式

见题面 Output 部分

样例输入
16
样例输出
1