#include <bits/stdc++.h>
using namespace std;
int v;
int a[10], mn(100000), mi, mnn(0);
vector<int> ans;
int main() {
  cin >> v;
  for (int i(1); i != 10; ++i) {
    cin >> a[i];
    if (a[i] <= mn) {
      mn = a[i];
      mi = i;
    }
  }
  mnn = v / mn;
  v %= mn;
  if (v != 0 && mnn != 0) {
    for (int i(9); i >= mi; --i) {
      while (v + mn >= a[i] && mnn != 0) {
        mnn--;
        ans.push_back(i);
        v = v + mn - a[i];
      }
    }
  }
  for (int i(0); i != mnn; ++i) ans.push_back(mi);
  for (auto i = ans.begin(); i != ans.end(); ++i) {
    cout << *i;
  }
  if (mnn == 0 && ans.size() == 0) cout << "-1";
  return 0;
}
