#include <bits/stdc++.h>
using namespace std;
int main() {
  int v, temp, maxs, mins = numeric_limits<int>::max(), minsitem;
  vector<int> a;
  scanf("%d", &v);
  for (int i = 0; i < 9; i++) {
    scanf("%d", &temp);
    if (temp <= mins) {
      mins = temp;
      minsitem = i;
    }
    a.push_back(temp);
  }
  maxs = v / mins;
  if (maxs == 0) {
    printf("-1");
    return 0;
  } else {
    int remainder = v - maxs * mins;
    vector<int> ans;
    for (int i = 8; i != minsitem; i--) {
      while (a[i] - mins <= remainder) {
        ans.push_back(i);
        remainder -= a[i] - mins;
      }
    }
    for (auto i : ans) printf("%d", i + 1);
    for (int i = 0; i < maxs - static_cast<int>(ans.size()); i++) {
      printf("%d", minsitem + 1);
    }
  }
  return 0;
}
