Modular arithmetics I've been reading about some examples concerning DSS/DSA signature security and there is one part of an example that I do not understand the maths. Namely, how do you calculate this:
$w = (s^{-1}$ $mod$ $q)$ 
In this example let's say $q = 13$ and $s = 10$.
So we have
$w = (10^{-1}$ $mod$ $13) = 4$ 
How do we get 4 as a result? 

As $\displaystyle 10\cdot4=40\equiv1\pmod{13}$
$\displaystyle 10^{-1}\equiv4\pmod{13}$ dividing either sides by $10$ as $(10,13)=1$ 
