406207: GYM102309 I IPv6 Address of Orz Pandas

Memory Limit:256 MB Time Limit:1 S
Judge Style:Text Compare Creator:
Submit:0 Solved:0

Description

I. IPv6 Address of Orz Pandastime limit per test1 secondmemory limit per test256 megabytesinputstandard inputoutputstandard output

The University of Electronic Science and Technology of Orz Pandas (UESTOP) has recently implemented IPv6 protocol for the campus computer network. An IPv6 address is an 128-bit unsigned integer, for example $$$x = 42540578239448488099419523072699400193$$$.

Certainly it's hard to remember such an address. To make it prettier, we often convert it to a hexadecimal and then split the hexadecimal into $$$8$$$ sections. Each section is a $$$4$$$-bit hexadecimal and we can remove its leading zero. So $$$x$$$ can be represented as 2001:470:f003:0:0:0:0:1.

This is still too long, so it's allowed to remove several consecutive sections of zeros and replace them with a double colon (::). RFC 5952 recommands not to use a double colon to denote an omitted single section of zeros so we should obey. Certainly, the double colon can be used only once in an address or the address would become ambigious. For example, $$$x$$$ can be abbreviated to 2001:470:f003::1.

Now you are given an 128-bit IPv6 address and you should output its abbreviation. If there are multiple legal abbreviations, output the shortest one with least remaining sections. If there are still multiple shortest abbreviations, output the lexicographically smallest one.

Input

There are multiple test cases. Please process to EOF.

Each test case contains only one line, containing the integer $$$x$$$ ($$$0 \leq x < 2^{128}$$$).

Output

For each test case, output the abbreviated address.

ExampleInput
42540578239448488099419523072699400193
1
0
Output
2001:470:f003::1
::1
::

加入题单

算法标签: