#include<iostream>
using namespace std;
long long int baza(int n, int baza)
{
long long int r, b = 0, d = 1;
while(n)
{
r = n%baza;
b = r*d + b;
n /= baza;
d *= 10;
}
return b;
}
int main()
{
int n;
cin >> n;
cout << baza(n, 2);
cout << endl;
cout << baza(n, 8);
return 0;
}
long long int baza(int, int);