def get_deviation(number: int, circle: int) -> int:
    """Get distance to horizontal or vertical line from 1."""
    # Special case for memory storage center
    if number == 1:
        return 0

    # Side length derived from progression n'th child formula
    side = circle * 2 + 1

    # Normalize number - bottom left circle number is 0, then +1 clock-wise
    deviation = abs(number - side ** 2)

    # Split by side - number should not exceed side length - 1
    deviation %= side - 1

    # Subtract half of side length to count distance from side center
    deviation = abs(deviation - side // 2)

    return deviation