Frankie the Frog starts his morning at the origin in \mathbb{R}^{2}. He decides to go on a leisurely stroll, consisting of 3^{1}+3^{10}+3^{11}+3^{100}+3^{101}+3^{110}+3^{111}+3^{1000} moves, starting with the 1st move. On the nth move, he hops a distance of
\max \left\{k \in \mathbb{Z}: 3^{k} \mid n\right\}+1
then turns 90^{\circ} degrees counterclockwise. What is the square of the distance from his final position to the origin?