I found this definition for modulo
mod(a, n) = a - n * floor(a / n)
Doing an integer division and then multiplying it a