implemented chinese remainder theorem :D