Added formula for q