#P12277. Guaranteed Spell: Forming 'lanqiao'

    ID: 14386 Type: Default 1000ms 256MiB

Guaranteed Spell: Forming 'lanqiao'

Guaranteed Spell: Forming 'lanqiao'

Little Blue is fascinated by a word-forming game. He has a box of letter cards with the letters \(\tt l\), \(\tt a\), \(\tt n\), \(\tt q\), \(\tt i\), \(\tt o\) printed on them. There are exactly \(5\) cards for each letter. His goal is to form the word \(\tt lanqiao\), which requires one \(\tt l\), two \(\tt a\)'s, one \(\tt n\), one \(\tt q\), one \(\tt i\) and one \(\tt o\).

Unfortunately, while playing, Little Blue accidentally spilled all the cards under his bed. It is extremely dark under there so he cannot see the letters on the cards. In the worst-case scenario, how many cards must he draw in order to guarantee that he collects the necessary cards to form \(\tt lanqiao\)?

Note: Even though each letter is available with \(5\) copies, the critical letter is \(\tt a\) as it is needed twice. The worst-case scenario is when he picks all cards not providing the second required \(\tt a\) before finally drawing it.

inputFormat

There is no input for this problem.

outputFormat

Output a single integer representing the minimum number of cards Little Blue must draw to be sure of having enough cards to form the word lanqiao.

sample

No input
27