summaryrefslogtreecommitdiff
path: root/introductory_problems/bit_strings.cpp
blob: 84acfeacbfdfe235d074052a3221e2220b474cf0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// 1617. Bit Strings
#include <bits/stdc++.h>

const int mod = 1e9 + 7;

long long fast_pow2(int x) {
  long long res = 1, y = 2;
  while (x) {
    if (x & 1)
      res = (res * y) % mod;
    y = (y * y) % mod;
    x >>= 1;
  }
  return res;
}

int main() {
  static int n;
  scanf("%d", &n);
  printf("%lld\n", fast_pow2(n));
}