Package for this problem was not updated by the problem writer or Codeforces administration after we’ve upgraded the judging servers. To adjust the time limit constraint, solution execution time will be multiplied by 2. For example, if your solution works for 400 ms on judging servers, then value 800 ms will be displayed and used to determine the verdict.

Virtual contest is a way to take part in past contest, as close as possible to participation on time. It is supported only ACM-ICPC mode for virtual contests.
If you've seen these problems, a virtual contest is not for you - solve these problems in the archive.
If you just want to solve some problem from a contest, a virtual contest is not for you - solve this problem in the archive.
Never use someone else's code, read the tutorials or communicate with other person during a virtual contest.

No tag edit access

B. Color the Fence

time limit per test

2 secondsmemory limit per test

256 megabytesinput

standard inputoutput

standard outputIgor 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 *a*_{d} 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* ≤ 10^{6}). The second line contains nine positive integers *a*_{1}, *a*_{2}, ..., *a*_{9} (1 ≤ *a*_{i} ≤ 10^{5}).

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

Codeforces (c) Copyright 2010-2019 Mike Mirzayanov

The only programming contests Web 2.0 platform

Server time: Mar/21/2019 01:22:12 (f2).

Desktop version, switch to mobile version.

Supported by

User lists

Name |
---|