solved N Mod M