#include <bits/stdc++.h>
using namespace std;
int main(){
    int N;
    cin >> N;
    vector<int> c(9);
    for(int i = 0; i < 9; i++) cin >> c[i];
    long long temp = 0;
    for(int i = 8; i >= 0; i--){
        for(int j = 0; j < c[i]; j++){
            temp = temp * 10 + i + 1;
        }
    }
    cout << temp << endl;
}