Premium problem35. Conversion Rate Across a User Mixture

Easy Locked

A fraction q of your users are engaged and convert with probability p1. Everyone else converts with probability p2. Return the overall conversion probability for a user picked at random.

This is the law of total probability with two cases.

Input

q = 0.3
p1 = 0.5
p2 = 0.05

Output

0.185

Premium problem

This one's part of Premium. Unlock the full Probability track plus every other premium problem on the site.

Implement solve(...)