#include <bits/stdc++.h>
using namespace std;
int main() {
  long long int c, mi = 1e6;
  cin >> c;
  vector<long long int> v(11);
  for (long long int i = 1; i <= 9; i++) cin >> v[i], mi = min(mi, v[i]);
  if (mi > c) {
    cout << -1;
    return 0;
  }
  long long int s = 1;
  for (long long int i = 1; i <= 9; i++)
    if (v[i] <= v[s]) s = i;
  long long int no = c / v[s], rem = c % v[s];
  long long int re = -1, cnt = 0, in = 1;
  while (rem > 0 && in <= no) {
    re = -1;
    long long int x = rem + v[s];
    for (long long int i = s + 1; i <= 9; i++)
      if (v[i] <= x) re = i;
    if (re == -1) {
      cout << s;
      in++, cnt++;
      continue;
    } else
      cout << re;
    cnt++, rem = x - v[re], in++;
  }
  for (long long int i = 1; i <= no - cnt; i++) cout << s;
  cout << "\n";
}
