Limits 1s, 32 MB

Five friends **A**, **B**, **C**, **D** and **E** has come to a shop to buy crayons for their art project. They need crayons of **Na**, **Nb**, **Nc**, **Nd** and **Ne** distinct colors respectively. The shop has a strange rule. There are **M** crayons in the shop arranged in a row numbered from **1** to **M**. If you want to buy crayons, you have to choose two numbers **L** and **R** where **1 ≤ L ≤ R ≤M** and then you have to buy all the crayons numbered from **L** to **R**.

This is a companion discussion topic for the original entry at https://toph.co/p/crayons