FUNPROB - Yanu in Movie theatre


Yanu is a great fan of Harry Potter. So on the day of the movie release, Yanu rushes to the movie theatre to watch the movie. On the release of the 6th movie, on reaching the theatre she found a long queue for tickets already. As the distribution was about to start, the ticket counter did not have any change to start with. There are N+M people in queue, where N have Rs 10.00 and M have Rs 5.00. The ticket costs Rs 5.00.

Now Yanu is math geek too, now she wonders What is the probability that the theatre can always provide change.

Input

Each line contain N and M, separated by a space, End of Input is marked by 0 0 which should not be processed. Both N and M fits in integer range.

Output

For each input, output the respective probability up to 6 decimal digits.

Example

Input:
1 0
0 1
41 41
0 0

Output:
0.000000
1.000000
0.023810

hide comments
sohie: 2015-09-04 03:33:27

here is explanation of the solution <snip>

Last edit: 2023-06-30 20:27:21
vikas: 2014-08-11 12:49:13

whats the logic for O(1)? any useful links to understand ?

pvkcse: 2014-05-23 12:14:27

AC in one go with python...good problem on probability...had some work with pen and paper...!!!

Last edit: 2014-05-23 12:16:34
chaudhary: 2013-06-06 16:46:10

easy question!!

Himanshu: 2013-05-18 06:44:39

lol problem a guess can also work...........

gourav: 2012-12-25 09:39:43

lol... in one go, i thought it a difficult problem. :p sorry yani , you enjoy your movie :-)

unXled: 2012-06-27 07:44:16

tutorial !


Added by:Hemant Verma
Date:2009-08-15
Time limit:0.506s
Source limit:1024B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ERL JS-RHINO NODEJS PERL6 VB.NET
Resource:A Classical Probability Problem