I'm trying this example question,
with $g≡5$ mod $p$ being a generator and $p$=$647$ being prime
The question says Alice publishes her public key $y ≡ 57$ mod $p$
And the question says Bob receives messages $245$ and $428$ with signatures $(556,123)$ and $(270,418)$ respectively, which of the signatures are valid.
I've tried calculating $(556^{-57}).(123)$ mod $p$ and $(270^{-57}).(418)$ mod $p$ to see if it computes 245 or 428 respectively but I'm not sure if thats the way to go.
The first signature is correct, if we follow the signature algorithm on wikipedia , where we have no hash algorithm but just use $H(m) = m$ because $m$ is already in $\mathbb{Z}_p$.
So we have $p = 647$, $g=5$, $y = 57$ (the public key of Alice).
If the message is $m$ and the signature is $(r,s)$ the verification check is:
$$g^m = y^r \cdot r^s \pmod{p}$$
and the signature is valid iff it holds.
For $m=245$ and signature $(r,s) = (556,123)$ we have $g^m \pmod{p} = 90$, while $y^r = 57^{556} \pmod{p} = 450$ and $r^s \pmod{p} = 259$ and $259 \times 450 = 116550 \pmod{p} = 90$ so the equation checks out.
Now you can check yourself that this computation for the second message ( $m=428$ and $(s,r) = (270, 418)$) fails.
Your own attempted computation makes no sense to me, but we can reconstruct all computations that Alice made for the valid signature above, because all parameters are so small, we can find the secret keys etc.:
$x= 471$ (using a quick program, we only have < $p$ many options for the secret key ,so here we can try them out) and the chosen random mask $r = g^k \pmod {p}$ for some $k$, so in the case $(r,s) = (556,123)$ we have $k= 21$, as you can check. Then $k$ has an inverse modulo $p-1 =646$, namely $k^{-1} = 523$ (check that $523 \times 21 \pmod{646} = 1$), and $s$ is then computed as
$$s = (m-xr)k^{-1} \bmod{(p-1)} = (245 - 471\cdot 556)523 \bmod{646} = 123$$
giving the correct $(r,s)$ pair. Alice knows $x$ (her private key) and chose $k=21$ at random and then arrived at this signature. But the equation I gave is the way to check a given signature, because it only depends on the public parameter $y$ and the message $m$ itself and its signature $(r,s)$. The correctness proof(let) is on the linked Wikipedia page.