Multiples of 7

Given nn different digits between 1 and 9, find all the multiples of 7 that can be formed with the nn digits.

Input

Input consists of a number 1n91 \le n \le 9, followed by nn different digits between 1 and 9.

Output

Print all the multiples of 7 that can be formed with the nn digits. If there is none, print a hyphen.

Information about the checker

You can print the solutions to this exercise in any order.

Problem information

Author: Unknown
Translator: Carlos Molina

Generation: 2026-01-25T10:00:09.206Z

© Jutge.org, 2006–2026.
https://jutge.org