https://www.acmicpc.net/problem/10610
n = list(input()) n.sort(reverse=True) s = ''.join(n) if int(s) % 30 != 0: print(-1) else: print(int(s))
리스트를 문자열로 - ''.join(s) 각 자리 수의 합이 3의 배수