now mods C by max denomination value so should run in constant time