#include <bits/stdc++.h>
using namespace std;
int main() {
  int v, a[10], min = 999999, minpos = 1;
  scanf("%d", &v);
  for (int i = 1; i < 10; i++) {
    scanf("%d", &a[i]);
    if (min >= a[i]) {
      minpos = i;
      min = a[i];
    }
  }
  if (min > v) {
    printf("-1\n");
    return 0;
  }
  int till = v / min;
  if (v % min == 0) {
    for (int i = 0; i < till; i++) printf("%d", minpos);
    printf("\n");
  } else if (till == 1) {
    int max = -1;
    for (int i = 1; i < 10; i++) {
      if (a[i] <= v and a[i] >= max) {
        max = a[i];
        minpos = i;
      }
    }
    printf("%d\n", minpos);
  } else {
    int rem = v % min;
    int tot = rem + min;
    int max = -1, flag = 0, ctr = 0;
    int maxpos = minpos;
    while (1) {
      flag = 0, max = -1;
      for (int i = 1; i < 10; i++) {
        if (a[i] <= tot and i > minpos) {
          flag = 1;
          max = a[i];
          maxpos = i;
        }
      }
      rem = tot - max;
      tot = rem + min;
      if (flag == 1) {
        ctr++;
        printf("%d", maxpos);
      } else
        break;
    }
    for (int i = 0; i < till - ctr; i++) printf("%d", minpos);
    printf("\n");
  }
  return 0;
}
