#P8813. Exponential Calculation Warning
Exponential Calculation Warning
Exponential Calculation Warning
Given two positive integers \(a\) and \(b\), compute \(a^b\), which means multiplying \(a\) by itself \(b\) times. For example, \(2^3\) is \(2 \times 2 \times 2 = 8\).
If \(a^b\) exceeds \(10^9\), output \(-1\) as a warning to avoid potential overflow issues.
inputFormat
The input consists of a single line containing two positive integers (a) and (b) separated by a space.
outputFormat
Output the value of (a^b) if it does not exceed (10^9); otherwise, output (-1).
sample
2 3
8