|시간 제한||메모리 제한||제출||정답||맞은 사람||정답 비율|
|3 초||128 MB||0||0||0||0.000%|
Charles is an auto races fan and he has decided to make his own model’s collection. In the shop it is possible to buy models in closed and covered boxes. In each box there are parts for one model and a set of stickers with images of digits. In every box the set of stickers is the same. Charles decided to label models by consecutive integers starting from 1. For example, to label the 2070-th model four stickers are necessary: one sticker with ”2”, two with ”0” and one with ”7”.
Charles completes every model in the following way: he opens a new box, builds the model and labels it using sticker(s). He can use stickers from current and previously opened boxes, but it is not allowed to open an additional new box to get at missing stickers.
Write a program which for a given set of stickers counts how many models Charles can label in the described way.
In the only line of input ten one-digit integers
i0, i1, i2, i3, i4, i5, i6, i7, i8, i9
are given, where ij is the number of stickers with digit j,(0 ≤ j ≤ 9) in the sticker set of every box. Each two neighbour digits are separated by one space symbol.
The only line of output should contain one integer – number of labeled models.
1 1 1 1 1 1 1 1 1 1
3 4 5 4 3 4 5 4 3 4