#include<iostream>
#include<string>
#include<vector>
using namespace std;
int main()
{
int x;
string str="";
cin >> x;
int t = 32;
if (x < 0)
{
x = (-1)*x;
x = ~x + 1;//取補碼
}
while (t--)
{
str = to_string(x & 1)+str;
x = x >> 1;
}
cout << str << endl;
cout << hex << x;
return 0;
}