5945: Color the Fence

内存限制:256 MB 时间限制:1 S 标准输入输出
题目类型:传统 评测方式:文本比较 上传者:
提交:4 通过:3

题目描述

        伊戈尔爱上了达尼雅。现在伊戈尔想表达自己的感情,在谭雅家对面的栅栏上写一个数字。伊戈尔认为,数字越大,赢得谭雅心的机会就越大。
        不幸的是,伊戈尔只能得到 v 升油漆。他做了数学计算,并得出结论,数字d需要一个ad升油漆。此外,伊戈尔听说谭雅不喜欢零。这就是为什么伊戈尔不会在他的号码中使用它们。
        帮助伊戈尔找到他可以在栅栏上写的最大数字。

Igor has fallen in love with Tanya. Now Igor wants to show his feelings and write a number on the fence opposite to Tanya's house. Igor thinks that the larger the number is, the more chance to win Tanya's heart he has.

Unfortunately, Igor could only get v liters of paint. He did the math and concluded that digit d requires ad liters of paint. Besides, Igor heard that Tanya doesn't like zeroes. That's why Igor won't use them in his number.
Help Igor find the maximum number he can write on the fence.
Input
The first line contains a positive integer v (0≤v≤106). The second line contains nine positive integers a1,a2,...,a9 (1≤ai≤105).
Output
Print the maximum number Igor can write on the fence. If he has too little paint for any digit (so, he cannot write anything), print -1.
Examples
Input
5
5 4 3 2 1 2 3 4 5
Output
55555
Input
2
9 11 1 12 5 8 9 10 6
Output
33
Input
0
1 1 1 1 1 1 1 1 1
Output
-1

输入格式

第一行包含一个正整数 v (0≤V≤106).第二行包含九个正整数一个1,a2,...,a9 (1≤ai≤105).

输出格式

打印伊戈尔可以在栅栏上写入的最大数量。如果他的颜料太少,无法容纳任何数字(因此,他无法书写任何内容),请打印 -1。

Input

5

5 4 3 2 1 2 3 4 5

Output

55555

Input

2

9 11 1 12 5 8 9 10 6

Output

33

Input

0

1 1 1 1 1 1 1 1 1

Output

-1

输入样例 复制

0
1 1 1 1 1 1 1 1 1

输出样例 复制

-1