Skip to content

UKSPC Practice Problems » Perfect Numbers

For any number N, if the sum of N's divisors, excluding N itself, equals N, the number is called perfect. If the sum is less than N it is called deficient. If the sum is greater than N it is called abundant. Examples:

Write a program that will read in a number and classify it as perfect, deficient, or abundant.

Input Specification

Input will consist of a series of numbers, one per line. The input will be terminated by zero (0).

Output Specification

Output will consist of one line for each number in the input file and will echo the original number followed by the sum (both right justified in fields of width 4 columns) followed by one of the words 'perfect', 'deficient' or 'abundant', as shown in the example.

Sample Input


Sample Output

 6   6    perfect
 8   7  deficient
24  36   abundant