The number n can be written in base 14 as \underline{a} \underline{b} \underline{c}, can be written in base 15 as \underline{a} \underline{c} \underline{b}, and can be written in base 6 as \underline{a} \underline{c} \underline{a} \underline{c} \underline{c}, where a>0. Find the base-10 representation of n.