Problem H
Remoat Seating
![\includegraphics[width=0.4\textwidth ]{remoat_stadium_sm.png}](/problems/remoatseating/file/statement/en/img-0001.png)
The ranked world finals for Pokémon Unite1 have arrived. Contestant teams have been narrowed down to the top $14$ to participate in a double elimination bracket. The winning team will receive a set of $100$ Master Balls.
Each match consists of two teams of five Pokémon each facing off to capture wild Pokémon, score points, and win objectives. The team with the most points wins in the end. Though the matches have five Pokémon on a team, participants can register in teams of two or three, in which case they are randomly paired with another team to form a team of five.
Though only the top $14$ teams will compete in the world championship, all teams that participated have been invited to watch the games in Remoat Stadium. Seating will be provided in one row on the south side of the stadium. To reduce maintenance costs, only the minimum number of seats will be set up to match the needs of the event. All spectating teams would naturally prefer to sit with the rest of their team.
As the coordinator for the event, you have been asked to find the number of ways that all teams can sit together relative to the number of possible seating arrangements.
Input
The first line will consist of one positive integer $N$ $(2 \leq N)$, the number of teams that have registered.
The second line will consist of a list of integers, $t_1, \ldots t_ n$, where $t_ i$ represents the number of registered participants on team $i$.
You are given that $\sum _{i=1}^{n} t_ i \leq 20$ and $t_ i \in \{ 2, 3, 5\} $
Output
Output the number of ways that all teams can sit together relative to the total number of possible seating arrangements as a reduced fraction.
Sample Input 1 | Sample Output 1 |
---|---|
2 3 2 |
1/5 |
Sample Input 2 | Sample Output 2 |
---|---|
4 2 3 2 3 |
1/1050 |
Footnotes
- Pokémon Unite and above image © The Pokémon Company and Tencent Games. Used here for educational purposes only, in accordance with fair use as defined by section 107 of the Copyright Act.