← Back to Problems
Market Fragmentation
Medium standard Graphs & Networks Combinatorics Probability & Statistics
Time limit: 1 s per test  ·  Memory: 256 MB

A random market graph on n assets is built as follows. For every pair of assets i < j, a co-movement score rho_ij is drawn independently and uniformly from [-1, 1]. A filter with threshold theta = p / q is then applied: assets i and j are connected by an edge if and only if |rho_ij| >= theta.

Compute the expected number of connected components of the resulting graph.

Input

One line with the integers n, p and q.

Output

The expected number of connected components, as an exact fraction in lowest terms, written as a/b.

Constraints

2 <= n <= 30

1 <= p < q <= 1000

Note

In the first sample, n = 2 and theta = 1/2. The single potential edge is present if and only if |rho_12| >= 1/2, which has probability 1 - 1/2 = 1/2. The graph has 1 component when the edge is present and 2 components when it is not, so the expected number of components is 1 * (1/2) + 2 * (1/2) = 3/2.

Scoring

This is a standard problem: a submission scores full points if it produces the correct output for every test case, and zero otherwise.

Examples

input
2 1 2
output
3/2
input
4 1 3
output
848/729
Python 3.13 i Execution environment Isolated microVM · 1 vCPU · no internet access Time and memory limits are set per problem Available packages numpy 2.5.0scipy 1.18.0pandas 3.0.0scikit-learn 1.9.0statsmodels 0.15.0cvxpy 1.9.2