Explain why the scratch arithmetic algorithm works.