BALLSUM - Ball sum

You have a bag filled with N balls. Each ball has a distinct number from 1 to N printed on it. All the numbers are distinct. You withdraw two balls from the bag and take their sum. You need to calculate the probability that the sum is not greater than the given number K (<= N). The answer should be displayed in the form of p/q (except when the answer is 0 or 1.)

Input

Input consists of various test cases. Each test case consist of two integer inputs, N and K. (0 <= K <= N <= 1000000000) The program stops taking input when N and K equals -1.

Output

Output the result in the form of p/q (except when the answer is 0 or 1.)

Example

Input:
3 2
100 5
10 6
-1 -1

Output:
0
2/2475
2/15

Added by:Prateek Agarwal
Date:2015-12-15
Time limit:1s
Source limit:50000B
Memory limit:1536MB
Cluster: Cube (Intel G860)
Languages:All except: ASM64 GOSU JS-MONKEY

hide comments
2016-04-19 16:27:47
First solved by brute force then -> Simply AC

Last edit: 2016-04-22 06:14:46
2016-02-17 20:55:16
AC in one go.......
2016-01-25 15:32:59
sorov_0 tum itna tez kaise h.....
2016-01-25 15:32:21
ac in one go.....
2016-01-25 13:37:00
abhishek tum itna tez kase ho.....
2016-01-25 13:34:43
ac in one go...
2016-01-19 20:45:42 rahul2907
Nice one!!!! easy :)
2016-01-15 20:47:06
Easy one, little mathematical analysis is required....
2016-01-03 23:47:56
are you withdrawing 2 balls together or are you withdrawing a ball and then putting it back and then taking i out again?
What I mean is that for k<=6 are 4,2 and 2,4 separate cases and is 3,3 included?
SORRY GUYS MY BAD I AM DUMB!!!!

Last edit: 2016-01-04 01:10:36
2015-12-28 07:34:48 gomathi ganesan
Easy problem :D
© Spoj.com. All Rights Reserved. Spoj uses Sphere Engine™ © by Sphere Research Labs.