Game "15++"
Easy
Execution time limit is 1 second
Runtime memory usage limit is 64 megabytes
The game "15++" has now become popular in various TV shows. Participants are given the same sets of N cards, each of which has one of the numbers "5" or "7" written on it. The winner is the one who of these cards will lay out the maximum number that is divisible by 15. For example, if the participants receive 3 cards each {“7”, “5”, “7”}, then those who laid out the number 75 are declared the winners.####InputThe program enters one natural number from the keyboard: N (from 2 to 1000) - the number of cards, and then in the next line N digits 5 or 7.####OutputWrite in a single line the maximum number without gaps (not all cards can be used). If such a number cannot be obtained from this set, print the message "Impossible" (without quotes).
Examples
Input #1
Answer #1
Submissions 697
Acceptance rate 16%