small optimizations: prefer multiplication over division