#include <bits/stdc++.h>
using namespace std;
int i, j;
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(0), cout.tie(0);
  int v;
  cin >> v;
  int a[10];
  int min = INT_MAX, mini;
  for (i = 1; i < 10; i++) {
    cin >> a[i];
    if (a[i] <= min) {
      min = a[i];
      mini = i;
    }
  }
  int n1 = v / a[mini];
  if (n1 == 0) {
    cout << -1;
  } else {
    int x = v % a[mini];
    int b[n1];
    for (i = 0; i < n1; i++) {
      b[i] = mini;
    }
    j = 0;
    x += a[mini];
    int flag = 1;
    while (flag == 1) {
      flag = -1;
      for (i = 9; i > mini; i--) {
        if (x >= a[i]) {
          b[j] = i;
          j++;
          x += a[mini] - a[i];
          flag = 1;
          break;
        }
      }
    }
    for (i = 0; i < n1; i++) {
      cout << b[i];
    }
  }
  return 0;
}
