• Don't you also need to make sure that @n <> @r so you don't divide by 0? And @r <> 0 either.