You are given N numbers. You have to determine which one is positive and can be divisible by 396. If there are more than one, find the maximal. If several elements are maximal, find the second last one.
The first line of each testcase
contains the integer N (1 ≤ N ≤ 100000).
Each of the following N lines contains one non-negative number. The length of any line does not exceed 30000 characters. Total size of input file doesn’t exceed 8 MB.
For each testcase consist of exactly one line containing the desired number. Output 0 if no answer .
3 0003960 15 740916000000000000000 5 0003960 15122221 003960 3960 40916000000000000000 2 0 1
3 3 0
Migrated from old NTUJ.
icpc2008, neerc west
No. | Testdata Range | Score |
---|