#include <bits/stdc++.h>
using namespace std;
int main() {
  char ch[10] = {'0', '1', '2', '3', '4', '5', '6', '7', '8', '9'};
  int n;
  cin >> n;
  int a[10], x, y;
  cin >> a[1];
  x = a[1];
  y = 1;
  for (int i = 2; i < 10; i++) {
    cin >> a[i];
    if (a[i] <= x) {
      x = a[i];
      y = i;
    }
  }
  if (n < x) {
    cout << "-1";
    return 0;
  }
  string s;
  int counter = 0;
  int m;
  m = n % x;
  for (int i = 9; i > y; i--) {
    while (m >= a[i] - x) {
      s += ch[i];
      m = m - (a[i] - x);
      counter++;
    }
  }
  for (int i = 1; i <= n / x - counter; i++) {
    s += ch[y];
  }
  cout << s;
}
