#include <bits/stdc++.h>
using namespace std;
#define int long long
signed main() {
int N;
cin>>N;
if(N == 1){
cout<<0;
exit(0);
}
N--;
vector<int> v;
while(N){
v.push_back(N%5);
N/=5;
}
reverse(v.begin(),v.end());
for(auto i: v) cout<<i*2;
// your code goes here
return 0;
}
I2luY2x1ZGUgPGJpdHMvc3RkYysrLmg+CnVzaW5nIG5hbWVzcGFjZSBzdGQ7CiNkZWZpbmUgaW50IGxvbmcgbG9uZwpzaWduZWQgbWFpbigpIHsKCglpbnQgTjsKCWNpbj4+TjsKCWlmKE4gPT0gMSl7CgkJY291dDw8MDsKCQlleGl0KDApOwoJfQoJTi0tOwoJdmVjdG9yPGludD4gdjsKCXdoaWxlKE4pewoJCXYucHVzaF9iYWNrKE4lNSk7CgkJTi89NTsKCX0KCXJldmVyc2Uodi5iZWdpbigpLHYuZW5kKCkpOwoJZm9yKGF1dG8gaTogdikgY291dDw8aSoyOwoJLy8geW91ciBjb2RlIGdvZXMgaGVyZQoJcmV0dXJuIDA7Cn0=