Composition and porosity of multicomponent structures: porous silicon as a three-component system