#K68632. Counting Unique Sequences

    ID: 32908 Type: Default 1000ms 256MiB

Counting Unique Sequences

Counting Unique Sequences

Given a non-negative integer \(n\), calculate the value of \(2^n \bmod (10^9+7)\). This represents the total number of unique sequences of processes A and B of length \(n\). Note that when \(n=0\), there is exactly one sequence (the empty sequence). For example, when \(n=3\), there are \(2^3 = 8\) unique sequences.

Constraints:

  • \(0 \le n \le 10^{18}\)

Hint: Use fast modular exponentiation to handle the large exponent.

inputFormat

The input consists of a single line containing an integer (n) (where (0 \le n \le 10^{18})).

outputFormat

Output a single integer which is the value of (2^n \bmod (10^9+7)).## sample

1
2

</p>