eolymp
bolt
Try our new interface for solving problems
Problems

Dice Throwing

Dice Throwing

\textbf{n} common cubic dice are thrown. What is the probability that the sum of all thrown dice is at least \textbf{x}? \InputFile The input file contains several test cases. Each test case consists two integers \textbf{n} (\textbf{1} ≤ \textbf{n} ≤ \textbf{24}) and \textbf{x} (\textbf{0} ≤ \textbf{x} < \textbf{150}). The meanings of \textbf{n} and \textbf{x} are given in the problem statement. Input is terminated by a case where \textbf{n=0} and \textbf{x=0}. This case should not be processed. \OutputFile For each line of input produce one line of output giving the requested probability as a proper fraction in lowest terms in the format shown in the sample output. All numbers appearing in output are representable in unsigned \textbf{64}-bit integers.
Time limit 1 second
Memory limit 64 MiB
Input example #1
3 9
1 7
24 24
15 76
24 56
24 143
23 81
7 38
0 0
Output example #1
20/27
0
1
11703055/78364164096
789532654692658645/789730223053602816
25/4738381338321616896
1/2
55/46656