After decrypting an affine cypher I was left with the inverse encoder of $\displaystyle \frac{i - 2}{5}$ withibeing the particular letter of the alphabet with $\displaystyle a:=0$ up to $\displaystyle z:=25$

Take S for example, which decodes to Y, but $\displaystyle \frac{18-2}{5} = 3.2 = 24$ $\displaystyle mod$ $\displaystyle 26$

My work around.

$\displaystyle 18 + 4\times 26 = 122$

$\displaystyle 122 - 2 = 120$

$\displaystyle \frac{120}{5} = 24$

I don't know how to change decimals into a mod whole number. My get around was to keep adding 26 toiuntil I got a number ending in 2 or 7 so i could take 2 and divide by 5 and keep in the integers. Obviously this is a rather long winded way of doing it and it is using my inteligence rather than a algorithm a computer can do. I assume there must be a proper way of doing it but I can't find any info on it.

Thank you.