#include <algorithm>
#include <iostream>
#include <unordered_map>
#include <vector>
#include <stack>
#include <sstream>
#include <list>
#include <queue>
using namespace std;
void ten2two(int x) {
string s;
while (x) {
s.push_back((x & 1) + '0');
x >>= 1;
}
reverse(s.begin(), s.end());
cout << s << endl;
}
int force_for_cmp(int x) {
int cnt = 0, ans = x;
while (x) {
cnt++;
x = x & (x - 1);
}
while (true) {
int y = ++ans, cnt1 = 0;
while (y) {
cnt1++;
y = y & (y - 1);
}
if (cnt == cnt1) {
return ans;
}
}
return 0;
}
int main() {
int x = 3495382;
int y = x & (x - 1);
int z = x - y;
int y1 = y & (y - 1);
int z1 = y - y1;
int ans = 0;
if (z1 == (z << 1)) {
int t = y;
int append = 0;
while (t & z1) {
append = (append << 1) + 1;
t >>= 1;
}
ans = x + z + append;
}
else ans = y + (z << 1);
ten2two(x);
//ten2two(y);
//ten2two(z);
//ten2two(y1);
//ten2two(z1);
ten2two(ans);
ten2two(force_for_cmp(x));
}