Two Formats
Time limit2sMemory limit1024 MB
Given N as read on a little-endian device after a big-endian transfer, recover the original number M by reversing its three bytes.
- Level
Easy2 of 10
- Topics
- Math, Implementation
- Solved
- No attempts yet
Statement
A byte is a unit of information made of eight binary digits. One byte can therefore hold the integers from to . To store larger numbers, a computer uses several bytes. The number is written in base , and its digits are stored in the bytes. That is, to store (), bytes holding are used. For example, storing takes 3 bytes: , so the bytes hold , , and .
Devices differ in the order in which they store the bytes of one number. The two most common orders are big-endian and little-endian. Big-endian stores the bytes from the most significant digit to the least, in the order . For , this order is . Little-endian is the reverse of big-endian.
Now suppose a number is sent from a big-endian device to a little-endian device. The receiving device reads the bytes in its own order, so it may read a completely different number. For example, sending transmits the bytes . The receiver reads them as .
You are given the number recorded on the little-endian device after the number was received from the big-endian device. Recover .
Input
The first line contains one integer ().
Output
Print the number .