"""https://open.kattis.com/problems/oktalni"""

num = int(input())
print(oct(int(f"0b{num}", base=2))[2:])

bc2911122fbad46cf1ee15d760c8147bd747ec05
<mask token>

<mask token>
print(oct(int(f'0b{num}', base=2))[2:])

<mask token>
num = int(input())
print(oct(int(f'0b{num}', base=2))[2:])

"""https://open.kattis.com/problems/oktalni"""

num = int(input())
print(oct(int(f"0b{num}", base=2))[2:])
