Using StackOverflow trick for multiplying probabilities