Toilet-Ares finds a paper on the ground of Scholomance Academy, which says
Note that
)
is the number of positive integer which is smaller than

and co-prime with

. In particular
%3D1)
.
Now
Toilet-Ares wonders, when given

and

, what the value of
)
modulo

is supposed to be.
Of couse, Toilet-Ares who is phoning you, don't know how to solve this problem. Can you help him calculate the answer?