Multiples of 7 P11875


Statement
 

pdf   zip

thehtml

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

Input

Input consists of a number 1 ≤ n ≤ 9, followed by n different digits between 1 and 9.

Output

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

Information about the checker

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

Public test cases
  • Input

    4
    3 5 2 8
    

    Output

    3528
    2583
    2835
    8253
    
  • Input

    3
    2 5 7
    

    Output

    -
    
  • Information
    Author
    Salvador Roura
    Language
    English
    Translator
    Carlos Molina
    Original language
    Catalan
    Other languages
    Catalan
    Official solutions
    C++
    User solutions
    C++ Haskell Python