Problem B
Closing Early
Byron, the owner of a popular pizza shop renowned for its exclusive Hawaiian pizza, faces a unique challenge today. His shop operates on a strict policy: no pizza slices are wasted at the end of the day. Byron, an avid gamer, is eager to wrap up his day to play his favorite game, Hyper Space Pixel Conquerors (HSPC). However, he needs to ensure that he doesn’t have any leftover pizza slices before he leaves.
At the start of the day, Byron’s shop has exactly
Byron’s goal is to find the smallest number
Note that
Input
The first line containing three space-separated integers
The second line contains
Output
A single integer
Sample Input 1 | Sample Output 1 |
---|---|
7 10 5 2 1 4 12 6 |
3 |
Sample Input 2 | Sample Output 2 |
---|---|
0 7 3 1 2 3 |
0 |
Sample Input 3 | Sample Output 3 |
---|---|
5 9 7 4 2 1 3 3 6 3 |
-1 |