Use quotRem instead of div and mod