Multisect

Given a hidden failing revision among n candidates and up to K simultaneous tests per round, find the strategy that minimizes expected total cost when a round with i failures costs T_i.

Hard8Dynamic programmingBinary searchProbabilityCombinatoricsNo attempts yetTime limit2sMemory limit512 MB

Problem

We are developing the world's coolest AI robot product. After a long struggle, we finally sent revision RRCR_{\mathrm{RC}} of the product to the QA team as a release candidate. They reported that some tests failed. Because we were too lazy to set up a continuous integration system, we have no idea when the software broke. We only know that every test passed at the past revision RPASSR_{\mathrm{PASS}}. To find the revision RBUGR_{\mathrm{BUG}} (RPASS<RBUGRRCR_{\mathrm{PASS}} < R_{\mathrm{BUG}} \le R_{\mathrm{RC}}) at which the software started to fail, we have to test revisions one by one.

Assume the following.

  • A test at revision RR passes if R<RBUGR < R_{\mathrm{BUG}} and fails otherwise.
  • Every revision from RPASS+1R_{\mathrm{PASS}} + 1 to RRCR_{\mathrm{RC}} is equally likely to be RBUGR_{\mathrm{BUG}}.

By the first assumption we do not need to test every revision. It is enough to find the revision RR such that the test at R1R - 1 passes and the test at RR fails. We have KK testing devices, so we can test up to KK different revisions at the same time. We call this a parallel test. Because of the testing environment, we cannot start new tests until the current parallel test finishes, even when it does not use all KK devices.

A parallel test has a cost. The more tests fail, the more it costs. If ii tests fail in a parallel test, its cost is TiT_i (0iK0 \le i \le K). When we run several parallel tests, the total cost is the sum of their costs.

We want to minimize the total cost of determining RBUGR_{\mathrm{BUG}} by carefully choosing how many revisions, and which ones, to test in each parallel test. What is the minimum expected total cost under an optimal strategy?

Input

The input is a single test case in the following format.

RPASS RRC K
T0 T1 ... TK

RPASSR_{\mathrm{PASS}} and RRCR_{\mathrm{RC}} are integers, the revision numbers at which the test passed and failed, respectively, and 1RPASS<RRC10001 \le R_{\mathrm{PASS}} < R_{\mathrm{RC}} \le 1000. KK (1K301 \le K \le 30) is the maximum number of revisions that one parallel test can cover. TiT_i is an integer, the cost of a parallel test in which ii tests fail (0iK0 \le i \le K), and 1T0T1TK1000001 \le T_0 \le T_1 \le \cdots \le T_K \le 100000.

Output

Print the minimum expected total cost as an irreducible fraction in the form p/q on one line, where pp and qq are coprime integers and q1q \ge 1. When the value is an integer, print it with denominator 1 (for example, print 0/1 for 0).