Time limit per test: 0.25 second(s) Memory limit: 262144 kilobytes
input: standard output: standard
Andrew has just made a breakthrough in the world of number 17: he realized that it's rather easy to permute the digits in almost any given number to get a number divisible by 17. You are given a positive integer n. You must find a permutation of its digits that is divisible by 17.
Input file contains single integer n, 1 ≤ n ≤ 1017.
Output any permutation of digits of n that is divisible by 17. The output permutation may not start with a zero. If there is no such permutation, output -1.
Codeforces (c) Copyright 2010-2023 Mike Mirzayanov