#include <bits/stdc++.h>
using namespace std;
int main() {
  int v;
  cin >> v;
  int pa[9];
  for (int i = 0; i < 9; i++) {
    cin >> pa[i];
  }
  int min = pa[0], pos1 = 0;
  for (int i = 1; i < 9; i++)
    if (pa[i] < min) {
      min = pa[i];
      pos1 = i;
    }
  if (min > v)
    cout << "-1" << endl;
  else {
    int count = v / min;
    v = v % min;
    v = v + min;
    int tempc = 0;
    for (int j = 0; j < count; j++) {
      int pos2 = -1;
      for (int i = 8; i >= 0; i--) {
        if (v - pa[i] >= 0) {
          pos2 = i;
          break;
        }
      }
      if (pos2 != -1 && pos2 != pos1) {
        cout << (pos2 + 1);
        tempc++;
        v = v - pa[pos2] + pa[pos1];
      } else
        break;
    }
    for (int i = 0; i < count - tempc; i++) {
      cout << (pos1 + 1);
    }
  }
}
