It depends on how you want to use the painted shader and how you've set up the distance shader.
If you blend out clouds in the distance (white near camera, black far away), but want to make an "exception" by using a painted shader then you'll need to add the painted shader colour to the distance shader.
Create function -> add -> add colour and connect the distance shader and painted shader to it. The output of the add node is now the two masks combined.
If you blend in clouds in the distance (black near camera, white far away), but want to mask out certain parts with your painted shader then you can either subtract or multiply masks.
Use subtract if you paint unwanted parts in white. Create function -> subtract -> subtract colour and connect the distance shader and painted shader to it.
Sometimes it works a bit better to multiply masks. It's the same as above but then you define the unwanted parts in black in the painted shader.
However, you can still paint the unwanted parts in white. After you did, connect the painted shader as blendshader input of a distributionshader V4.
Activate blendshader and invert it.
Then create function -> multiply -> multiply colour and connect the two nodes again.
That's basically how I do these things.
There's also the merge shader (create other shader -> merge shader) which can do all of above functions.