#P1010. [NOIP 1998 普及组] 幂次方

[NOIP 1998 普及组] 幂次方

Description

Any positive integer can be expressed as a sum of powers of 22. For example, 137=27+23+20137=2^7+2^3+2^0.

We also agree to write exponents using parentheses, i.e., aba^b can be written as a(b)a(b).

Thus, 137137 can be written as 2(7)+2(3)+2(0)2(7)+2(3)+2(0).

Furthermore, 7=22+2+207= 2^2+2+2^0 (where 212^1 is written as 22), and 3=2+203=2+2^0.

Therefore, the final expression for 137137 is 2(2(2)+2+2(0))+2(2+2(0))+2(0)2(2(2)+2+2(0))+2(2+2(0))+2(0).

Another example: 1315=210+28+25+2+11315=2^{10} +2^8 +2^5 +2+1.

Thus, the final expression for 13151315 is 2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0)2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0).

Input Format

One line containing a positive integer nn.

Output Format

Output the agreed "0, 2" representation of nn (no spaces are allowed in the expression).

1315
2(2(2+2(0))+2)+2(2(2+2(0)))+2(2(2)+2(0))+2+2(0)

Hint

  • Constraints: For 100%100\% of the testdata, 1n2×1041 \le n \le 2 \times {10}^4.
  • NOIP 1998 Junior, Problem 3.

Translated by ChatGPT 5