def base (val ,b):
	ans = ""
	while int(val):
		ans += convert[int(val % b)]
		val /= b
	return ans
convert = {
	0 : "0", 1 : "1", 2 : "2", 3 : "3",
	4 : "4", 5 : "5", 6 : "6", 7 : "7",
	8 : "8", 9 : "9", 10 : "A", 11 : "B",
	12 : "C", 13 : "D", 14 : "E", 15 : "F"
}
while True:
	val = input("Enter a number : ")
	if val == "D" : break
	val = int(val)
	if not val :
		print("Decimal : 0")
		print("Hexadecimal : 0")
	print("Decimal : %s" %(base(val,2)[::-1]))
	print("Hexadecimal : %s" %(base(val,16)[::-1]))