| Saudi CPC |
|---|
| Открытая |
| Зритель |
| Saudi CPC Qualifications 2022 |
|---|
| Закончено |
SaudiCPC is kicking off for the first time ever. Brilliant contestants from all over Saudi Arabia are gathering and forming teams of 3 to compete for a chance to qualify to the ACPC.
Abdullah Aldhalaan, Ahmad Jubairi and Norah Allohaidan are forming a great team of young brilliant software engineers. They are showing a great deal of impressive teamwork essential for any team success.
While they were training for the contest, they encountered a new problem. The problem gives $$$N$$$ integers $$$A_1, A_2, ..., A_N$$$ , and it asks to calculate the product $$$P = A_1 · A_2 · ... · A_N$$$ . If $$$P$$$ is less than or equal to $$$(2^{63} − 1)$$$, the solution should print $$$P$$$, otherwise it should print $$$-1$$$.
Of course this problem was so easy for the team and they could solve it. Can you solve it too?
First line contains an integer $$$N$$$ $$$(2 ≤ N ≤ 10^5)$$$, the number of integers.
Second line contains $$$N$$$ integers $$$(0 ≤ Ai ≤ 10^3)$$$.
If the product of all numbers in $$$A$$$ is less than or equal to $$$(2^{63} − 1)$$$, print it, otherwise print $$$-1$$$.
5 5 4 3 2 1
120
| Название |
|---|


