What is the average of all positive integers that have four digits when written in base $3$, but two digits when written in base $6$? Write your answer in base $10$.
<|im_start|>system
You are a helpful assistant.<|im_end|>
<|im_start|>user
What is the average of all positive integers that have four digits when written in base $3$, but two digits when written in base $6$? Write your answer in base $10$.
Please reason step by step, and put your final answer within \boxed{{}}.<|im_end|>
<|im_start|>assistant

user
31
What is the average of all positive integers that have four digits when written in base $3$, but two digits when written in base $6$? Write your answer in base $10$.
train