#P8114. Hexagon Warrior's Might
Hexagon Warrior's Might
Hexagon Warrior's Might
A cute equiangular hexagon has all its interior angles equal to \(\frac{2\pi}{3}\). Its pairs of opposite sides have lengths \(a\), \(b\), and \(c\) (in units) respectively, arranged in cyclic order \(a, b, c, a, b, c\). In the battle power evaluation, an examiner constructs a series of parallel lines on each line containing the sides of the hexagon at an interval of \(\frac{\sqrt{3}}{2}\) units. This process divides the hexagon into many small equilateral triangles. By connecting all adjacent (sharing a common edge) equilateral triangles, a bipartite graph is formed. Since there are no odd cycles, one may construct a perfect matching of this bipartite graph. The battle power of the hexagon warrior is defined as the number of possible perfect matchings of the bipartite graph.
Your task is to help Cirno determine the battle power of the hexagon warrior, i.e. the number of perfect matchings modulo \(998244353\). The answer is given by the famous MacMahon formula for the lozenge tilings of a hexagon with side lengths \(a,b,c,a,b,c\):
[ \prod_{i=1}^{a} \prod_{j=1}^{b} \prod_{k=1}^{c} \frac{i+j+k-1}{i+j+k-2} \mod 998244353. ]
Note: It is guaranteed that the given hexagon can be tiled by lozenges without gaps or overlaps, and the computed product always yields an integer.
inputFormat
The input consists of a single line containing three space-separated positive integers \(a\), \(b\), \(c\), which represent the lengths of the three pairs of opposite sides of the hexagon.
It is guaranteed that \(1 \leq a, b, c \leq 100\).
outputFormat
Output one integer, the number of perfect matchings in the tiling (i.e. the battle power of the hexagon warrior) modulo \(998244353\).
sample
1 1 1
2