implemented Chinese Remainder Algorithm