# How to get to the next step in the procedure?

This procedure is used to solve a modular exponentiation problem, say

Here is the procedure

How do you get from the first step to the second step?

To get $a^2$ mod m on the left side, I would multiply both sides of the first step by a to get

$a^2$ mod m $\equiv a^2$ (mod m )

How do i get from that to $(a$mod m$)^2$ mod m?