def transfor_ip(ip):
    if '.' in ip:
        l=ip.split('.')
        ll= [bin(int(i)).replace('0b','').rjust(8,'0') for i in l ]
        return int(''.join(ll),2)
    if ip.isdigit():
        bin_string=bin(int(ip)).replace('0b','').rjust(32,'0')
        return '.'.join([str(int(bin_string[i:i+8],2)) for i in range(0,32,8)])
import sys

for line in sys.stdin:
    ip=line.strip()
    res=transfor_ip(ip)
    print(res)