I've been asked to calculate $3^{12000027}\pmod{35}$ without the use of a calculator. I'm new to modular arithmetic, so I searched for the possible approaches to this problem. The fastest way I could find is the right-to-left binary method described here. I've implemented this algorithm in a program to evaluate how many iterations it would take, which turns out to be $24$. The number $12000027$ is not prime, so Fermat's Little Theorem doesn't appear to be applicable.
Is there some other trick that can be applied for this particular number, or is there really no faster way to determine the solution? It seems like an unnecessary amount of manual labour.