#include <bits/stdc++.h>
using namespace std;
unsigned long long n;
int a[210] = {0}, l = 0, i = 0, c[100], sum, w;
string s, b, ans;
int main(){
cin >> n;
if(n == 0){
cout << "00";
return 0;
}
while(n){
int sum = n % 2;
a[++l] = sum;
n /= 2;
}
while(i * 7 <= l){
i++;
for(int j = 1; j <= 7; j++){
s += a[(i - 1) * 7 + j] + '0';
}
if(i * 7 < l){
s += '1';
}
else{
s += '0';
}
for(int j = s.size() - 1; j >= 0; j--){
b += s[j];
}
for(int j = 0; j < b.size(); j++){
c[j] = b[j] - '0';
}
sum = 0;
w = 1;
for(int j = b.size() - 1; j >= 0; j--){
sum += c[j] * w;
w *= 2;
}
int w = sum;
while(w){
int sum = w % 16;
if(sum >= 10){
ans += sum + 55;
}
else{
ans += sum + 48;
}
w /= 16;
}
if(ans.size() == 1){
cout << "0";
}
for(int j = ans.size(); j >= 0; j--){
cout << ans[j];
}
cout << " ";
ans = "";
b = "";
s = "";
}
return 0;
}