I'm not sure what you are asking me to solve but in
modular arithmetic we aren't arbitrarily changing the sign of a negative number to positive. Instead the congruent number is computed.
For example if the modulus is 7 then -1 becomes 6 or -9 becomes 5.
Essentially we compute (a mod m) then if the result was negative we add modulus to the result.
-9%7=-2 -> -2+7=5 -> -9 ≡ -2 ≡ 5 (mod 7)
As for square root, it is also different in modular arithmetic. You have to compute r so that r
2≡a (mod 9).
For secp256k1 curve we have a simple solution to compute ModPow(a, (p+1)/4, p) but in general cases where p%4 != 3 we have to use an algorithm like
Tonelli–Shanks.