Problem 11185 solved, Ternary