John, John, and Rob's solution with a minor maths bug.