An introduction to an ancient Chinese algorithm and its modification