rewriting chinese-remainder