Prefixes are often used with units of digital information (notably bytes1, bits2, and bits per second) to make large quantities more human readable. However, the computer industry has historically used the units kilobyte, megabyte, and gigabyte, and the corresponding symbols KB, MB, and GB, in at least two slightly different measurement systems. In citations of main memory (RAM3) capacity, gigabyte customarily means 1.073.741.824 bytes. As this is a power of 1024, and 1024 is a power of two ($$2^{10}$$), this usage is referred to as a binary measurement.
In most other contexts, the industry uses the multipliers kilo, mega, giga, etc., in a manner consistent with their meaning in the International System of Units4 (SI), namely as powers of 1000. For example, a 500 gigabyte hard disk holds 500.000.000.000 bytes, and a 1 Gbit/s (gigabit per second) Ethernet5 connection transfers data at 1.000.000.000 bit/s. In contrast with the binary prefix usage, this use is described as a decimal prefix, as 1000 is a power of 10 ($$10^3$$).
Traditionally the SI multipliers kilo, mega, giga, terra etc. were used. However, in the computer industry they were used in a different manner than officially prescribed. Because storage capacity is often expressed in powers of 2 and $$2^{10} = 1024$$ is so close to 1000, it was decided it would be useful to call 1024 bytes a kilobyte, instead of 1000 bytes. This became confusing when storage capacity increased. A floppy disk of 1.44 megabyte, for example, does not have the capacity of $$1.44 \times 1024 \times 1024$$ byte, nor of $$1.44 \times 1000 \times 1000$$ byte, but of $$1.44 \times 1024 \times 1000$$ byte.
The use of the same unit prefixes with two different meanings has caused confusion. Starting around 1998, the International Electrotechnical Commission6 (IEC) and several other standards and trade organizations addressed the ambiguity by publishing standards and recommendations for a set of binary prefixes that refer exclusively to powers of 1024. Accordingly, the US National Institute of Standards and Technology7 (NIST) requires that SI prefixes8 only be used in the decimal sense: kilobyte9 and megabyte10 denote one thousand bytes and one million bytes respectively (consistent with SI), while new terms such as kibibyte11, mebibyte12 and gibibyte13, having the symbols KiB, MiB, and GiB, denote 1024 bytes, 1.048.576 bytes, and 1.073.741.824 bytes, respectively. In 2008, the IEC prefixes were incorporated into the international standard system of units used alongside the International System of Quantities14 (see ISO/IEC 8000015).
SI | IEC | ||||||
---|---|---|---|---|---|---|---|
kilo | K | $$10^3$$ | 1,000 | kibi | Ki | $$2^{10}$$ | 1,024 |
mega | M | $$10^6$$ | 1,000,000 | mebi | Mi | $$2^{20}$$ | 1,048,576 |
giga | G | $$10^9$$ | 1,000,000,000 | gibi | Gi | $$2^{30}$$ | 1,073,741,824 |
tera | T | $$10^{12}$$ | - | tebi | Ti | $$2^{40}$$ | - |
peta | P | $$10^{15}$$ | - | pebi | Pi | $$2^{50}$$ | - |
exa | E | $$10^{18}$$ | - | exbi | Ei | $$2^{60}$$ | - |
zetta | Z | $$10^{21}$$ | - | zebi | Zi | $$2^{70}$$ | - |
yotta | Y | $$10^{24}$$ | - | yobi | Yi | $$2^{80}$$ | - |
The input consists of 4 integers, each on a separate line. These numbers express the number of bytes in SI units, and respectively represent the amount of gigabytes, megabytes, kilobytes and bytes. The last three values lie between 0 and 999 (boundaries included).
Write out the total amount of bytes described in the input in bytes (first line) and in IEC units (second line). The description in IEC units should respectively represent the number of gibibytes, mebibytes, kibibytes and bytes, of which the last three values should always lie between 0 and 1023 (boundaries included). Use the format of the following example as template to write out the output.
Input:
2
980
259
6
Output:
2980259006b
2Gib, 794Mib, 201Kib, 190b