#C7428. Reverse Integer with 32-bit Overflow Check

    ID: 51298 Type: Default 1000ms 256MiB

Reverse Integer with 32-bit Overflow Check

Reverse Integer with 32-bit Overflow Check

You are given a 32-bit signed integer n. Your task is to reverse the digits of the integer. If the reversed integer overflows the 32-bit signed integer range \( [-2^{31}, 2^{31}-1] \), then output 0.

For example, if n = 123, the reverse is 321, and if n = -456, the reverse is -654. Remember to take care of potential overflow after reversing.

inputFormat

The input consists of a single integer n provided via standard input (stdin).

outputFormat

Output the reversed integer on standard output (stdout). If the reversed integer overflows the 32-bit signed integer range \( [-2^{31}, 2^{31}-1] \), print 0.

## sample
123
321