#C2288. Nth Magic Number

    ID: 45587 Type: Default 1000ms 256MiB

Nth Magic Number

Nth Magic Number

You are given a positive integer \( n \). Your task is to compute the \( n \)th magic number.

A magic number is defined as the sum of distinct powers of 5. In other words, every magic number can be expressed as:

\( \sum_{i \in S} 5^i \)

where \( S \) is a set of distinct non-negative integers. Equivalently, if you write the index \( n \) in its binary representation, every bit set to 1 corresponds to including the corresponding power of 5 into the sum.

For example:

  • For \( n = 1 \), its binary is 1 so the magic number is \( 5^0 = 1 \).
  • For \( n = 2 \), its binary is 10 so the magic number is \( 5^1 = 5 \).
  • For \( n = 3 \), its binary is 11 so the magic number is \( 5^0+5^1 = 6 \).

Your task is to implement a program that reads \( n \) from the standard input and outputs the corresponding magic number.

inputFormat

The input consists of a single line containing one integer \( n \) (where \( n \ge 1 \)).

outputFormat

The output should be a single integer — the \( n \)th magic number.

## sample
1
1

</p>