/*
In the name of Allah
made by: Ahmed_Solyman
*/
#include <bits/stdc++.h>
#include <ext/rope>
using namespace std;
using namespace __gnu_cxx;
#pragma GCC optimize("-Ofast")
#pragma GCC optimize("-O1")
//-------------------------------------------------------------//
typedef long long ll;
typedef unsigned long long ull;
#define fast ios_base::sync_with_stdio(0);cin.tie(0);cout.tie(0);
#define PI acos(-1)
#define all(v) v.begin(),v.end()
#define allr(v) v.rbegin(),v.rend()
#define sum_to(n) (n*(n+1))/2
#define pb push_back
#define pf push_front
#define endl "\n"
#define fil(arr,x) memset(arr,x,sizeof(arr))
int dx[8]={0,1,0,-1,1,1,-1,-1};
int dy[8]={1,0,-1,0,1,-1,-1,1};
//-------------------------------------------------------------//
ll lcm(ll a,ll b)
{
return (max(a,b)/__gcd(a,b))*min(a,b);
}
int alice(const int n, const char names[][5],
const unsigned short numbers[], bool outputs_alice[]) {
for (int i=0;i<16;i++) {
if ((1<<i) & numbers[0]) {
outputs_alice[i]=1;
}
else {
outputs_alice[i]=0;
}
}
return 16;
}
int bob(const int m, const char senders[][5],
const char recipients[][5], bool outputs_bob[]) {
for (int i=0;i<=m;i++)
outputs_bob[i]=0;
return m+1;
}
int circuit(const int la, const int lb, int operations[],
int operands[][2], int outputs_circuit[][16]) {
for (int i=0;i<20000000;i++) {
operands[i][0]=operands[i][1]=0;
operations[i]=1;
}
int mark=la+lb;
int f=1e7;
auto Xor=[&](int ga,int gb,int gc) {
operations[gc]=6;
operands[gc][0]=ga;
operands[gc][1]=gb;
return void();
};
auto And=[&](int ga,int gb,int gc) {
operations[gc]=8;
operands[gc][0]=ga;
operands[gc][1]=gb;
return void();
};
auto Or=[&](int ga,int gb,int gc) {
operations[gc]=14;
operands[gc][0]=ga;
operands[gc][1]=gb;
return void();
};
auto add=[&](int l,int a,int mark) {
for (int i=0;i<=15;i++) {
Xor(l+i,a+i,f+1);
Xor(f+1,f,mark+i);
And(l+i,a+i,f+2);
And(f+1,f,f+3);
Or(f+2,f+3,f+4);
f+=4;
}
return void();
};
int h=lb-1;
if (h==0) {
for (int i=0;i<=15;i++) {
outputs_circuit[0][i]=la;
}
return 20000000;
}
return 20000000;
}