#include <fstream>
#include <cmath>
using namespace std;

int main() 
{
	ifstream f("DE002_2.inp");
	long long n,i,m;
	f>>n;
	f.close();
	ofstream f1("DE002_2.out");
	while (n!=0)
        {
			i=n%16;
			n=n/16;
		}
	}
    while (n!=0)
    {
    	m=n%2;
    	n=n/2;
	}
    f1<<i<<' '<<m;
		f1.close();
	return 0;
}
