#B3954. Little A's Multiplication Exercise
Little A's Multiplication Exercise
Little A's Multiplication Exercise
Little A has just started learning multiplication. To help him practice, we give him several positive integers and ask him to multiply them together.
For most cases, Little A can compute the product exactly. However, if the product exceeds \(10^6\), he is unable to compute it.
Your task is to write a program that simulates Little A's answer. In other words, if the product of the given numbers is no more than \(10^6\), output the product; otherwise, output -1.
inputFormat
The input begins with a single integer \(n\) (\(1 \leq n \leq 100\)), indicating the number of positive integers. The next line contains \(n\) positive integers separated by spaces. Each integer is between 1 and 100 (inclusive).
outputFormat
If the product of these numbers does not exceed \(10^6\), output the product. Otherwise, output -1.
sample
3
2 3 4
24