#K75687. Next Perfect Square

    ID: 34475 Type: Default 1000ms 256MiB

Next Perfect Square

Next Perfect Square

Given a non-negative integer sq, determine if it is a perfect square. That is, check whether there exists an integer \( n \) such that \( n^2 = sq \). If \( sq \) is a perfect square, output the next perfect square \( (n+1)^2 \); otherwise, output -1.

For example, if the input is 121, since \( 11^2 = 121 \), the answer should be \( 12^2 = 144 \>.

inputFormat

The input consists of a single non-negative integer provided via standard input.

outputFormat

Output a single integer to standard output. This integer is the next perfect square if the input is a perfect square, otherwise -1.

## sample
121
144