Solution to 41.
Added sanity check to 41.
Moved undigits to common module.
Generic version of undigits.