#include using namespace std; int n; int c[9]; long long m = 0; int main() { cin >> n; for (int i = 0; i < 9; i++) cin >> c[i]; for (int i = 8; i >= 0; i--) { while (c[i] > 0) { m *= 10; m += i + 1; c[i]--; } } cout << m << endl; }