while True: try: s = input().split('.') num = int(input()) res = '' for n in s: n = int(n) b = bin(n) res += str(b[2:].zfill(8)) # res += str(b[2:].rjust(8, "0")) print(int(res, 2)) b_num = bin(num) b_num_str = str(b_num[2:]).rjust(32, '0') tmp = '' res2 = [] g = len(b_num_str) // 8 for i in range(g): tmp = b_num_str[8 * i: 8 * i + 8] tmp = int(tmp, 2) res2.append(str(tmp)) print('.'.join(res2)) except: break