#include <iostream>
using namespace std;
 
const int TEN = 10;
 
int main() {
	int n, x, currentDigit;
	cin >> n >> x;
	while (cin >> currentDigit) {
		if (currentDigit == 1) {
			++n;
		} else {
			n *= TEN;
		}
	}
	cout << n;
	return 0;
}