P7174 [COCI 2014/2015 #4] CESTA
Description
Mirko found a positive integer $n$. Since Mirko likes the number $30$, he wants to know the largest multiple of $30$ among the numbers that can be formed using each digit of $n$.
Write a program to compute this number (if it does not exist, output `-1`).
Input Format
One number $n$.
Output Format
Only one line: the required number.
Explanation/Hint
#### Constraints
For $100\%$ of the testdata, the number of digits of $n$ does not exceed $10^5$.
#### Notes
**This problem is translated from [COCI2014-2015 CONTEST #4](https://hsin.hr/coci/archive/2014_2015/contest4_tasks.pdf) _T1 CESTA_.**
Translated by ChatGPT 5