#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int a[10] = {0};
int main() {
  bool ok = false;
  int v, dig, cur, p, len, ost, mn = 1000000000;
  scanf("%d", &v);
  for (int(i) = (1); (i) <= (9); ++(i)) {
    scanf("%d", &a[i]);
    if (a[i] <= mn) {
      dig = i;
      mn = a[i];
    }
  }
  len = v / mn;
  if (!len) {
    printf("-1\n");
    return 0;
  }
  ost = v % mn;
  for (int(i) = 0; (i) < (len); ++(i)) {
    p = dig;
    for (int(j) = (9); (j) >= (1); --(j))
      if (ost + a[dig] >= a[j]) {
        p = j;
        break;
      }
    printf("%d", p);
    ost = ost + a[dig] - a[p];
  }
  printf("\n");
  return 0;
}
