๋ฐฑ์ค 10610๋ฒ
์ฝ๋
๐ ์ฒ์์ ์ ๋ ฌ์ ๋จผ์ ํ๊ณ ๋ฐ๋ณต๋ฌธ์ ๋๋ ธ๋๋ฐ.. ๊ฐ ์๋ฆฌ ์ซ์์ ํฉ์ด 3์ ๋ฐฐ์์ด๋ฉด ์ด ์ซ์๋ 3์ ๋ฐฐ์๋ผ๋ ๊ฒ์ ์ด์ฉํ๊ณ ์ ๋ ฌ์ ํด์ผํ๋ค.
const fs = require('fs');
const input = fs.readFileSync('/dev/stdin').toString().trim().split('').map(Number);
if (!input.includes(0) || input.reduce((a, b) => a + b, 0) % 3 !== 0) {
console.log(-1);
} else {
input.sort((a, b) => b - a);
console.log(input.join(""));
}