#K2761. Finding the n-th Perfect Number

    ID: 24809 Type: Default 1000ms 256MiB

Finding the n-th Perfect Number

Finding the n-th Perfect Number

A perfect number is a positive integer that is equal to the sum of its proper divisors, excluding itself. In mathematical terms, a number \(N\) is perfect if

[ N = \sum_{d\mid N,, d<N} d ]

Your task is to find the n-th perfect number.

If the provided integer \(n\) is less than or equal to zero, the output should be \(-1\).

For example:

  • If \(n = 1\), the output should be 6.
  • If \(n = 2\), the output should be 28.

Note: Perfect numbers are rare. The known sequence starts as 6, 28, 496, 8128, 33550336,  ...

inputFormat

The input consists of a single integer \(n\) provided via standard input (stdin), which represents the order of the perfect number to be found.

outputFormat

Output a single integer representing the n-th perfect number. If \(n \leq 0\), output \(-1\).

## sample
1
6