const readline = require('readline')
const rl = readline.createInterface({
input: process.stdin
})
rl.on('line', function(line){
console.log(main(line))
})
function main(input_data) {
let base_data = [
{number: '0', value: '08'},
{number: '1', value: '124'},
{number: '2', value: '1235'},
{number: '3', value: '236'},
{number: '4', value: '1457'},
{number: '5', value: '24568'},
{number: '6', value: '3569'},
{number: '7', value: '478'},
{number: '8', value: '05789'},
{number: '9', value: '689'}
]
let final_data
let i = 0
if (input_data.length == 1) {
final_data = base_data.find(item => item.number == input_data)
return final_data = final_data.value.split('').join(',')
}
final_data = []
input_data = input_data.split('')
input_data.sort()
while (i < input_data.length) {
final_data[i] = base_data.find(item => item.number == input_data[i])
final_data[i] = final_data[i].value.split('')
++i
}
let result = final_data.reduce((acc1, num1) => acc1.reduce((acc2, num2) => acc2.concat(num1.map(num3 => [].concat(num2, num3))), []))
result = result.map(acc1 => acc1.join(''))
return result = result.join(',')
}
final_data.reduce((acc1, num1) => acc1.reduce((acc2, num2) => acc2.concat(num1.map(num3 => [].concat(num2, num3))), []))
final_data.reduce((acc1, num1) => {
return acc1.reduce((acc2, num2) => {
acc2.push(...num1.map(num3 => [...num2, ...num3]));
return acc2;
}, [])
})
return final_data.reduce((acc1, num1) =>
acc1.reduce((acc2, num2) => (
acc2.push(...num1.map(num3 => num2 + num3)),
acc2
), [])
).join(',');