I have to find the modular inverse of a sequence of numbers. When I do the inverse of $5\pmod {37}$, I get $-7$. $37 = 7(5)+2$ $5 = 2(2)+1\text{, then}$ $2 = 1(37)-7(5).$
so the inverse is $-7.$
But $-7\times 5 \pmod{37}$ is $2$. Shouldn't it be $1$?
I need to use this value for two later problems so it's messing it all up.