View as PDF

Submit solution

Points: 1
Time limit: 1.0s
Memory limit: 256M

Problem types

Bico and Fako are on lockdown. They are extremely bored and are trying to figure out some new challenges (sometimes with very little sense behind).

Here is the next idea by Fako! Bico has one \(\mathbf{N}\)-face die and one \(\mathbf{M}\)-face die. His initial score is zero \(s = 0\). If Bico rolls the dice with outcome values \(a\) and \(b\) respectively then his score will change to \(s + |a-b|\). What is the expected number of rolls until Bico reaches a score of at least \(\mathbf{K}\)?

Note that \(1 \le a \le \mathbf{N}\) and \(1 \le b \le \mathbf{M}\). For each die all possible outcome values are equiprobable.



The only line contains three integers \(\mathbf{N}\), \(\mathbf{M}\), and \(\mathbf{K}\).

  • \(2 \leqslant \textbf{N}, \textbf{M} \leqslant 100\),
  • \(1 \leqslant \textbf{K} \leqslant 10^9\).


The expected number of rolls. Your output will be considered as correct if it's absolute or relative error is less than \(0.0001\).


Input 1:

3 3 1

Output 1:


Input 2:

4 3 2

Output 2: