Conformal blocks in Virasoro and W theories: duality and the Calogero-Sutherland model