On a Poincar, type formula for solutions of singular and degenerate elliptic equations