converts a trinary input to base 10