num = int(input()) 
hex _representation = hex(num).upper()[2:]  
oct _representation = oct(num)[2:] 

print(hex_repersentation)
print(oct_representation)