uva 11346 probability

How do i solve uva 11346 problem? I can not understand this problem. Please help me.

//