input ternary code into problem//commented as necessary