P(x)=\cases{q,&x = 0\cr p,&x = 1$}