Niyaz's solution to problem 573, 'The Snail'