I'm not sure what this inverse chi-square is.
BUT you should multiple the two densities and then integrate out the S.
The product of densities of X|S and S with give you the joint of X and S.
To get the marginal density of X, you then need to integrate out the S variable.