--- from: http://rosettacode.org/wiki/Chinese_remainder_theorem