1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
#include <bits/stdc++.h>

using namespace std;

string username;
string algosia = "Algosia";
string bajtek = "Bajtek";

bool is_algosia() {
	return username == algosia;
}

bool is_bajtek() {
	return username == bajtek;
}

long long n, t;
long long a_x, b_x;
long long curr_mul_b_x;

void send_msg(long long x) {
	for (int i = 1; i <= 100; ++i) {
		if (x > 0) {
			cout << '1';
			--x;
		}
		else {
			cout << '0';
		}
		if (i % 10 == 0) cout << '\n';
	}
	cout.flush();
}

long long receive_msg() {
	long long output = 0;
	char tmp;
	for (int i = 0; i < 100; ++i) {
		cin >> tmp;
		if (tmp == '1') ++output;
	}
	return output;
}

void solve() {
	if (is_algosia()) {
		cin >> a_x;
	}
	if (is_bajtek()) {
		b_x = 0;
		curr_mul_b_x = 1;
	}
	
	int curr_moves = 0;
	while (curr_moves++ < 18) {
		if (is_algosia()) {
			send_msg(a_x % 10);
			a_x /= 10;
		}
		else {
			b_x += receive_msg() * (curr_mul_b_x++);
		}
	}
	if (is_bajtek()) {
		cout << b_x << '\n';
		cout.flush();
	}
}

int main() {
	ios_base::sync_with_stdio(false);
    cin.tie(NULL);
    cout.tie(NULL);
    
    cin >> username;
    cin >> n >> t;

    while (t--) solve();
    return 0;
}