shorten code
optimization: reuse known remainder