407167: GYM102697 138 Perfect Numbers

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

138. Perfect Numberstime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output
This problem is worth 15 points.

A number is considered a perfect number if and only if the sum of its divisors, except for the number itself, is equal to the original number. For example, 28 is a perfect number because its divisors are $$$1$$$, $$$2$$$, $$$4$$$, $$$7$$$, and $$$14$$$, and $$$1$$$ + $$$2$$$ + $$$4$$$ + $$$7$$$ + $$$14$$$ = $$$28$$$.

Given an integer $$$n$$$, figure out whether or not it is a perfect number, and what the sum of its divisors (except for $$$n$$$) is.

Input

The only line of input consists of a single integer $$$n$$$.

Output

Output two lines.

On the first line, output "PERFECT NUMBER" (no quotes) if the number is a perfect number, and "NOT A PERFECT NUMBER" (no quotes) if the number is not a perfect number. On the second line, output the sum of divisors of the number.

ExamplesInput
28
Output
PERFECT NUMBER
28
Input
48
Output
NOT A PERFECT NUMBER
76
Note

All numbers used in calculations are guaranteed to fit inside of a Java "int" data type.

加入题单

算法标签: