from __future__ import division, print_function
import math

import os
import sys
from io import BytesIO, IOBase

if sys.version_info[0] < 3:
    from __builtin__ import xrange as range
    from future_builtins import ascii, filter, hex, map, oct, zip

def main():
    pass

# region fastio

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
    """Prints the values to a stream, or to sys.stdout by default."""
    sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
    at_start = True
    for x in args:
        if not at_start:
            file.write(sep)
        file.write(str(x))
        at_start = False
    file.write(kwargs.pop("end", "\n"))
    if kwargs.pop("flush", False):
        file.flush()

if sys.version_info[0] < 3:
    sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
    sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

def input(): return sys.stdin.readline().rstrip("\r\n")

n = int(input().rstrip())

list1 = {}

def prime(t1):
    if t1 == 1 and t1 == n:
        return 6
    elif t1 == n:
        return 4
    elif t1 == 1:
        t2 = prime(t1+1)
        return 6*t2*t2
    else:
        t2 = prime(t1+1)
        return 4*t2*t2

res = prime(1)
print(res % (10**9 + 7))


n = int(input())
sz = len(str(n))
def get(x):
    ans = 0
    nw = 1
    x1 = x
    for i in range(sz):
        x = x1
        if x < nw:
            while x < nw: x *= 10
            x -= 1 #тк сука [1;x)
        else:
            while x >= nw * 10: x //= 10
        x = min(x, n)
        ans += x - nw + 1
        nw *= 10
    return ans

MOD = 998244353

ans = 0
i = 1
while i <= n:
    l = i
    r = min(n, 10 ** (len(str(i))) - 1) + 1
    nw = (get(i) - i) // MOD
    while r - l > 1:
        mid = (l + r) // 2
        x = (get(mid) - mid) // MOD
        if nw == x:
            l = mid
        else:
            r = mid
    ans += nw * (r - i)
    # i += 1
    i = r
print(ans * -MOD)


    # n = int(input())
    x1, x2 = map(int, input().split())
    y1, y2 = map(int, input().split())
    # arr= list(map(int, input().split()))
    # output_arr =[]
    if x1+x2+y1+y2==4:
        print(2)
    elif x1+x2+y1+y2==0:
        print(0)
    else:
        print(1)


# from bisect import bisect_left
import heapq
import os
from collections import deque

import io

# input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

TC = int(input())

a_ord = ord('a')

for tc in range(TC):
    N, M, K = map(int, input().split())

    if N % 2 == 1:
        if K < M // 2:
            print('NO')
            continue
        else:
            K -= M // 2
            N -= 1

    while K >= N:
        K -= N
        M -= 2

    if K > 0 and M < 2:
        print('NO')
        continue

    if K % 2 == 0:
        print('YES')
        continue
    else:
        print('NO')
        continue


import sys
input = lambda:sys.stdin.readline().rstrip()

T = int(input())

# keys = values of coin
# d = depth
# val = target value to make with coins
# cnt = number of coin left
def dfs(keys, d, val, cnt):
    if d == len(keys): return False
    key = keys[d]
    for c in range(cnt+1):
        if val - key*c < 0:
            return False
        elif val - key*c == 0 and cnt-c == 0:
            return True
        else:
            if d == len(keys):
                return False
            else:
                if dfs(keys, d+1, val - key*c, cnt-c): return True

for _ in range(T):
    n, m, k = map(int, input().split())
    if n%2 == 0 and m%2 == 0:
        if k%2 == 0:
            print('YES')
        else:
            print('NO')
    else:
        if m%2 == 0:
            n, m = m, n
        else:
            k = (n*m)//2 - k
        keys = [v for v in range(1, m+1, 2)]
        total = 0

        if dfs(keys, 0, k, n//2):
            print('YES')
        else:
            print('NO')


import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")
#######################################
# #######
  #     #
  #######
  #   #
  #    #
  #      #   Rahul Kaushik.2.0 #

for i in range(1):
    n,m=map(int,input().split())
    dp=[0]*(n+1)
    s=[0]*(n+2)
    dp[n]=1

    s[n]=1
    for i in range(n-1,0,-1):
        dp[i]=s[i+1]
        j=2
        while i*j<=n:
            if (i+1)*j-1<=n:
                dp[i]+=s[j*i]-s[(i+1)*(j)]
            else:
                dp[i]+=s[j*i]
            j+=1
        s[i]+=s[i+1]+dp[i]

    print(dp[1]%m)


# Legends Always Come Up with Solution
# Author: Manvir Singh

import os
import sys
from io import BytesIO, IOBase

def main():
    n, m = map(int, input().split())
    dp = [0] * (n + 1)
    dp[1] = 1
    su = 1
    for i in range(2, n + 1):
        dp[i] = su
        j = 2
        while j < i:
            z = i // j
            y = (i + z - 1) // z
            f = (y == j)
            dp[i] = (dp[i] + dp[z] * (y - j + f)) % m
            j = y + f
        dp[i] = (dp[i] + dp[i // j]) % m
        su = (su + dp[i]) % m
    print(dp[-1])

# FASTIO REGION

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()


from sys import stdin
input = stdin.readline

def add(x , y):return ((x%mod) + (y%mod))%mod

def answer():

    dp = [0]*(n + 1)
    prefix = [0]*(n + 2)

    #st = segtree(n)

    dp[n] = 1

    for i in range(n , 0 , -1):

        prefix[i] = prefix[i + 1]

        dp[i] = add(dp[i] , prefix[i])

        for k in range(2*i , n + 1):
            if((k//2) < i):break

            for j in range(2 , k + 1):

                if((k//j) == i):dp[i] = add(dp[i] , dp[k])
                if((k//j) < i):break

        prefix[i] = add(prefix[i] , dp[i])

    return dp[1]

for T in range(1):

    n , mod = map(int,input().split())

    print(answer())


s = input()
n = len(s)

valid10 = {"0","2","5","7"}
valid1 = {"0","5"}
if n < 2:
    if s == "0" or s == "X" or s == "_":
        print("1")
    else:
        print("0")
    exit(0)

if n == 2:
    if s == "__":
        print(3)
        exit(0)
    elif s == "_X":
        print(3)
        exit(0)

if s[0] == "0":
    print(0)
    exit(0)

if s[n-2] not in valid10 and s[n-2] not in ["X","_"]:
    print("0")
    exit(0)

if s[n-1] not in valid1 and s[n-1] not in ["X","_"]:
    print("0")
    exit(0)

x = "X" in s
zero = s[0] == "X"

validX = {"0","1","2","3","4","5","6","7","8","9"}
if zero:
    validX.remove("0")

ans = 1

for i,c in enumerate(s[:-2]):
    if c == "_":
        if i == 0:
            ans *= 9
        else:
            ans *= 10

if s[-2] in ["2","7"] and s[-1] == "X":
    validX = validX.intersection({5})
if s[-2] in ["0","5"] and s[-1] == "X":
    validX = validX.intersection({0})
if s[-1] == "0" and s[-2] == "X":
    validX = validX.intersection({"0","5"})
if s[-1] == "5" and s[-2] == "X":
    validX = validX.intersection({"2","7"})
if s[-2:] == "XX":
    validX = validX.intersection({"0"})
if s[-2:] == "X_":
    validX = validX.intersection(valid10)
if s[-2:] == "_X":
    validX = validX.intersection(valid1)
    ans *= 2
if s[-2:] == "__":
    ans *= 4

if x:
    ans *= len(validX)
print(ans)


def main():

    # n = 6
    # from random import randint
    # selection = '0123456789_X'
    # selection = '012579_X'
    # s = ''.join([selection[randint(0, len(selection) - 1)] for _ in range(n)])
    # if s[0] == '0':
    #     return

    s = input()
    n = len(s)
    # print(s)

    if n == 1:
        if s in '0_X':
            print(1)
        else:
            print(0)
        return

    def canmatchlen2(s1, s2):
        for i in range(2):
            if s1[i] == '_' or s1[i] == s2[i]:
                continue
            else:
                return False
        return True

    def count(s):  # with no 'X'
        if s == '0' * n:
            return 1
        if n > 1 and s[0] == '0':  # illegal
            return 0
        # see if can make zzz00, zzz25, zzz50, or zzz75
        last2 = s[n - 2:]
        last2cnts = 0
        for s2 in ['00', '25', '50', '75']:
            if canmatchlen2(last2, s2):
                last2cnts += 1
        if n == 2:
            if canmatchlen2(last2, '00'):
                last2cnts -= 1
            return last2cnts
        # see how many different numbers can the rest make
        otherscnts = 1
        for i in range(n - 2):
            if s[i] == '_':
                if i == 0:
                    otherscnts *= 9
                else:
                    otherscnts *= 10
        return last2cnts * otherscnts

    ans = 0
    if 'X' in s:
        for x in [str(z) for z in range(10)]:
            ans += count(s.replace('X', x))
    else:
        ans = count(s)
    print(ans)

    # # naive
    # nans = 0
    # xindexes = []
    # for i in range(n):
    #     if s[i] == 'X':
    #         xindexes.append(i)
    # for i in range(int(1e8)):
    #     s2 = str(i)
    #     if len(s2) < n: continue
    #     if len(s2) > n: break
    #     if i % 25 == 0:
    #         ok = True
    #         for j in xindexes:
    #             if s2[xindexes[0]] != s2[j]:
    #                 ok = False
    #         for j in range(n):
    #             if not (s[j] == '_' or s[j] == 'X' or s[j] == s2[j]):
    #                 ok = False
    #         if ok:
    #             nans += 1
    # print(nans)
    # if ans != nans:
    #     print(s)

    return

import sys
# input=sys.stdin.buffer.readline #FOR READING PURE INTEGER INPUTS (space separation ok)
input=lambda: sys.stdin.readline().rstrip("\r\n") #FOR READING STRING/TEXT INPUTS.

def oneLineArrayPrint(arr):
    print(' '.join([str(x) for x in arr]))
def multiLineArrayPrint(arr):
    print('\n'.join([str(x) for x in arr]))
def multiLineArrayOfArraysPrint(arr):
    print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
    return [int(x) for x in input().split()]
# def readFloatArr():
#     return [float(x) for x in input().split()]

def makeArr(defaultValFactory,dimensionArr): # eg. makeArr(lambda:0,[n,m])
    dv=defaultValFactory;da=dimensionArr
    if len(da)==1:return [dv() for _ in range(da[0])]
    else:return [makeArr(dv,da[1:]) for _ in range(da[0])]

def queryInteractive(a, b, c):
    print('? {} {} {}'.format(a, b, c))
    sys.stdout.flush()
    return int(input())

def answerInteractive(x1, x2):
    print('! {} {}'.format(x1, x2))
    sys.stdout.flush()

inf=float('inf')
# MOD=10**9+7
# MOD=998244353

from math import gcd,floor,ceil
import math
# from math import floor,ceil # for Python2

for _abc in range(1):
    main()


import threading
import sys
input=sys.stdin.readline
threading.stack_size(10**8)
sys.setrecursionlimit(10**7)

from collections import defaultdict

def main():
	s = input()
	global res
	res = 0

	def valid(x):
	    if not x:
	        return False
	    if x[0] == '0' and len(x) > 1:
	        return False
	    if '_' in x:
	        return False
	    if 'X' in x:
	        return False
	    if not int(x) % 25:
	        return True

	def l_str(x):
	    return ''.join(x)

	vis = set()

	def dfs(x):
	    global res
	    if valid(x) and x not in vis:
	        res += 1
	        vis.add(x)
	    if 'X' in x:
	        xc = x
	        for i in range(10):
	            xc = x.replace('X', str(i))
	            dfs(xc)
	    else:
	        x = list(x)
	        for i in range(len(x)):
	            if x[i] == '_':
	                for j in range(10):
	                    x[i] = str(j)
	                    dfs(l_str(x))
	                break

	dfs(s)
	print(res)

threading.Thread(target=main).start()


s = input()
global res
res = 0

def valid(x):
    if not x:
        return False
    if x[0] == '0' and len(x) > 1:
        return False
    if '_' in x:
        return False
    if 'X' in x:
        return False
    if not int(x) % 25:
        return True

def l_str(x):
    return ''.join(x)

vis = set()

def dfs(x):
    global res
    if valid(x) and x not in vis:
        res += 1
        vis.add(x)
    if 'X' in x:
        xc = x
        for i in range(10):
            xc = x.replace('X', str(i))
            dfs(xc)
    else:
        x = list(x)
        for i in range(len(x)):
            if x[i] == '_':
                for j in range(10):
                    x[i] = str(j)
                    dfs(l_str(x))
                break

dfs(s)
print(res)


import sys
sys.setrecursionlimit(100000)

def _r(): return sys.stdin.buffer.readline()
def rs(): return _r().decode('ascii').strip()
def rn(): return int(_r())
def rnt(): return map(int, _r().split())
def rnl(): return list(rnt())

def solve(s):
    if len(s) == 1:
        return int(s in '0_X')
    def _solve(s):
        if s[0] == '0':
            return 0
        uc = s.count('_')
        xm = 10 if 'X' in s else 1
        return xm*10**uc if s[0] not in 'X_' else xm*10**uc//10*9
    l2 = s[-2:]
    if l2 in ('25', '50', '75', '00'):
        return _solve(s)
    elif l2 == 'XX':
        return _solve(s.replace('X', '0'))
    elif l2 == 'X5':
        return _solve(s.replace('X', '2')) + _solve(s.replace('X', '7'))
    elif l2 == 'X0':
        return _solve(s.replace('X', '5')) + _solve(s.replace('X', '0'))
    elif l2 == '2X' or l2 == '7X':
        return _solve(s.replace('X', '5'))
    elif l2 == '5X' or l2 == '0X':
        return _solve(s.replace('X', '0'))
    elif l2 == '__':
        return _solve(s[:-2] + '25') + _solve(s[:-2] + '50') + _solve(s[:-2] + '75') + _solve(s[:-2] + '00')
    elif l2 == '_5':
        return _solve(s[:-2] + '25') + _solve(s[:-2] + '75')
    elif l2 == '_0':
        return _solve(s[:-2] + '50') + _solve(s[:-2] + '00')
    elif l2 == '2_' or l2 == '7_':
        return _solve(s[:-1] + '5')
    elif l2 == '5_':
        return _solve(s[:-1] + '0')
    elif l2 == '_X' or l2 == 'X_':
        return _solve(s.replace('X', '0')[:-2] + '00') + _solve(s.replace('X', '0')[:-2] + '50') + _solve(s.replace('X', '5')[:-2] + '25') + _solve(s.replace('X', '5')[:-2] + '75')
    return 0

print(solve(rs()))

# for _ in range(rn()):
#     n = rn()
#     edges = [rnt() for _ in range(n-1)]
#     print(solve(n, edges))


# ------------------- fast io --------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

# ------------------- fast io --------------------
from math import ceil

def prod(a, mod=10 ** 9 + 7):
    ans = 1
    for each in a:
        ans = (ans * each) % mod
    return ans

def gcd(x, y):
    while y:
        x, y = y, x % y
    return x

def lcm(a, b): return a * b // gcd(a, b)

def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y

for _ in range(int(input()) if not True else 1):
    # n, k = map(int, input().split())
    # a, b = map(int, input().split())
    # c, d = map(int, input().split())
    # a = list(map(int, input().split()))
    # b = list(map(int, input().split()))
    s = [int(k) if k.isdigit() else k for k in input()]

    start = 0
    if len(s) > 1:
        start = 10**(len(s) - 1)
    while start % 25:
        start += 1
    ans = 0
    done = False
    while 1:
        if done:break
        x = start
        ind = len(s) - 1
        XV = None
        pos = True
        while x:
            if ind < 0:
                pos = False
                done = True
                break
            d = x % 10
            if s[ind] == "_":
                pass
            elif s[ind] == 'X':
                if XV is None:
                    XV = d
                elif XV != d:
                    pos = False
            else:
                if s[ind] != d:
                    pos = False
            x = x // 10
            ind -= 1
        if pos:
            ans += 1
        start += 25
    print(ans)


from __future__ import division, print_function
import math
import sys
import os
from io import BytesIO, IOBase
#from collections import deque, Counter, OrderedDict, defaultdict
#import heapq
#ceil,floor,log,sqrt,factorial,pow,pi,gcd
#import bisect
from bisect import bisect_left,bisect_right

BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = "x" in file.mode or "r" not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b"\n") + (not b)
			ptr = self.buffer.tell()
			self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode("ascii"))
		self.read = lambda: self.buffer.read().decode("ascii")
		self.readline = lambda: self.buffer.readline().decode("ascii")

def print(*args, **kwargs):
	"""Prints the values to a stream, or to sys.stdout by default."""
	sep, file = kwargs.pop("sep", " "), kwargs.pop("file", sys.stdout)
	at_start = True
	for x in args:
		if not at_start:
			file.write(sep)
		file.write(str(x))
		at_start = False
	file.write(kwargs.pop("end", "\n"))
	if kwargs.pop("flush", False):
		file.flush()

if sys.version_info[0] < 3:
	sys.stdin, sys.stdout = FastIO(sys.stdin), FastIO(sys.stdout)
else:
	sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")

def inp():
    return(int(input()))
def inps():
    return input().strip()
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input().strip()
    return(list(s[:len(s)]))
def invr():
    return(map(int,input().split()))
v=[]
strt=0
while(strt<10**7+100):
    v.append(strt)
    strt+=25
s=input().strip()
n=len(s)
strt=bisect_left(v,10**(n-1))
end=bisect_right(v,10**(n)+1)
if n==1:
    strt=0
    end=2
cnt=0
for i in range(strt,end-1):
    target=str(v[i])
    flag=1
    X=-1
    for i in range(n):
        if s[i]==target[i]:
            continue
        elif s[i]=='_':
            continue
        elif s[i]=='X':
            if X==-1:
                X=target[i]
            else:
                if target[i]==X:
                    continue
                else:
                    flag=0
                    break
        else:
            flag=0
            break
    if flag:
        cnt+=1
print(cnt)


tmp = input()

def can(s, t):
    if len(s) != len(t):
        return False
    if 'X' in t:
        for ch in range(10):
            if can(s, t.replace('X', str(ch))):
                return True
        return False
    for i in range(len(s)):
        if s[i] == t[i] or t[i] == '_':
            continue
        else:
            return False
    return True

if len(tmp) <= 4:
    x = 0
    answer = 0
    while len(str(x)) <= len(tmp):
        if can(str(x), tmp):
            answer += 1
        x += 25
    print(answer)
    exit(0)

def get_prefix(pref):
    if pref[0] == '0':
        return 0
    answer = 1
    if pref[0] == '_':
        answer = 9
    for i in range(1, len(pref)):
        if pref[i] == '_':
            answer *= 10
    return answer

def get_suffix(suff):
    answer = 0
    for good in ['00', '25', '50']:
        if can(good, suff):
            answer += 1
    return answer

def get(t):
    if 'X' in t:
        answer = 0
        for x in range(10):
            answer += get(t.replace('X', str(x)))
        return answer

    if tmp[0] == '0':
        return 0

    pref = t[0:len(t) - 2]
    suff = t[len(t) - 2:len(t)]
    return get_prefix(pref) * get_suffix(suff)

print(get(tmp))


import math,sys;input=sys.stdin.readline;S=lambda:input().rstrip();I=lambda:int(S());M=lambda:map(int,S().split());L=lambda:list(M());mod1=1000000007;mod2=998244353

def check(s, num):
    if len(s) != len(num):
        return False
    x = -1
    for j in range(len(s)):
        if s[j] == '_':
            continue
        if s[j] == 'X':
            if x == -1:
                x = num[j]
                continue
            else:
                if x != num[j]:
                    return False
                else:
                    continue
        if s[j] != num[j]:
            return False
    return True

if __name__ == '__main__':
    s = str(input())
    tot = 0
    for i in range(0, 10**8, 25):
        i = str(i)
        if len(i) > len(s):
            break
        if check(str(s), i):
            tot += 1
    print(tot)


import sys
input = sys.stdin.readline
# sys.setrecursionlimit(400000)
def I(): return input().strip()
def II(): return int(input().strip())
def LI(): return [*map(int, input().strip().split())]
import copy, string, math, time, functools, fractions
from heapq import heappush, heappop, heapify
from bisect import bisect_left, bisect_right
from collections import deque, defaultdict, Counter, OrderedDict
from itertools import permutations, chain, combinations, groupby
from operator import itemgetter
from types import GeneratorType  # for recursion
from typing import Iterable, TypeVar, Union  # for sorted set

for _ in range(1):
    inp = list(I())
    n = len(inp)
    if inp == ['0']:
        print(1)
        continue
    if n < 2:
        print(0)
        continue
    if n < 3:
        if list('__') == inp or list('_X') == inp or list('X_') == inp:
            print(3)
        elif list('XX') == inp:
            print(0)
        elif list('_5') == inp or list('X5') == inp:
            print(2)
        elif list('_0') == inp or list('X0') == inp:
            print(1)
        elif list('2_') == inp or list('5_') == inp or list('7_') == inp or list('2X') == inp or list('5X') == inp or list('7X') == inp:
            print(1)
        elif list('25') == inp or list('50') == inp or list('75') == inp:
            print(1)
        else:
            print(0)
        continue
    ans = 0
    r = 9
    if 'X' not in inp:
        r = 1
    for x in range(r):
        temp = copy.deepcopy(inp)
        for i in range(n):
            if temp[i] == 'X':
                temp[i] = str(x)
        if temp[0] == '0':
            continue
        var = 1
        if temp[-1] == temp[-2] == '_':
            var *= 4
        elif temp[-1] == '_':
            if not (temp[-2] == '0' or temp[-2] == '2' or temp[-2] == '5' or temp[-2] == '7'):
                continue
        elif temp[-2] == '_':
            if not (temp[-1] == '0' or temp[-1] == '5'):
                continue
            var *= 2
        else:
            if not ((temp[-2] == '0' and temp[-1] == '0') or (temp[-2] == '2' and temp[-1] == '5') or (temp[-2] == '5' and temp[-1] == '0') or (temp[-2] == '7' and temp[-1] == '5')):
                continue
        # print(temp)
        if temp[0] == '_':
            var *= 9
        for i in range(1, n - 2):
            if temp[i] == '_':
                var *= 10
        ans += var
    print(ans)


def check(s, i):
  if i == len(s):
    x = ''.join(s)
    if x[0] == '0' and x != '0':
      return 0
    if int(x)%25 == 0:
      return 1
    return 0
  res = 0
  if s[i] == '_':
    for j in range(10):
      s[i] = str(j)
      res += check(s, i+1)
    return res
  else:
    return check(s, i+1)

inp = input()
total = 0
if 'X' in inp:
  for i in range(10):
    s = inp
    s = s.replace('X', str(i))
    total += check(list(s), 0)
else: total = check(list(inp), 0)

print(total)


def check(s, i):
  if i == len(s):
    x = ''.join(s)
    if x[0] == '0' and x != '0':
      return 0
    if int(x)%25 == 0:
      return 1
    return 0
  res = 0
  if s[i] == '_':
    for j in range(10):
      s[i] = str(j)
      res += check(s, i+1)
    s[i] = '_'
    return res
  else:
    return check(s, i+1)

inp = input()
total = 0
if 'X' in inp:
  for i in range(10):
    s = inp
    s = s.replace('X', str(i))
    total += check(list(s), 0)
else: total = check(list(inp), 0)

print(total)


import math
import random
import sys

def main(s):

    if (len(s)==1 and (s[0]=="0" or s[0]=="_" or s[0]=="X")):
        return 1
    elif (s[0]=="0" and len(s)>1):
        return 0
    elif (len(s)==1):
        return 0
    mult1=1
    mult2=1
    f=False
    for i in range(len(s)-2):

        if s[i]=="_":
            if (i!=0):
                mult1*=10
            else:
                mult1*=9
        elif s[i]=="X":
            if (i!=0):
                mult2=10
            else:
                mult2=9
                f=True
    ans=0
    for i in range(100):
        if (i%25)!=0:
            continue
        val=list([c for c in str(i)])
        if (i==0):
            val=["0","0"]

        mult_val=mult2
        check=[s[-2],s[-1]]

        if check[0]=="X":
            if (val[0]=='0' and f):
                continue
            check[0]=val[0]
            mult_val=1
            if check[1]=="X":

                check[1]=val[0]

        if (check[1]=="X" and check[0] !="X"):
            if (val[1]=='0' and f):
                continue
            check[1]=val[1]
            mult_val=1
        if (check[0]=="_"):
            check[0]=val[0]
        if (check[1]=="_"):
            check[1]=val[1]
        if (val==check) and not (len(s)==2 and check[0]=="0"):
            ans+=mult_val*mult1

    return ans

s=input()
print(main(s))


def main(s):
    rst = 0
    legal_single = ['X', '_', '0']
    for ls in legal_single:
        if ls == s: return 1
    if len(s) < 2 or s.startswith('0'): return rst
    legal_ends = ['X', '_', '0', '5']
    if s[-1] not in legal_ends: return rst
    legal_2nds = ['X', '_', '0', '2', '5', '7']
    if s[-2] not in legal_2nds: return rst
    if s.endswith('XX'): return main(s.replace('X', '0'))
    elif s.endswith('X_'):
        rst += main(s.replace('X', '0')[:-1] + '0')
        rst += main(s.replace('X', '2')[:-1] + '5')
        rst += main(s.replace('X', '5')[:-1] + '0')
        rst += main(s.replace('X', '7')[:-1] + '5')
        return rst
    elif s.endswith('_X'):
        rst += main((s[:-2] + '00').replace('X', '0'))
        rst += main((s[:-2] + '25').replace('X', '5'))
        rst += main((s[:-2] + '50').replace('X', '0'))
        rst += main((s[:-2] + '75').replace('X', '5'))
        return rst
    elif s.endswith('__'):
        rst += main((s[:-2] + '00'))
        rst += main((s[:-2] + '25'))
        rst += main((s[:-2] + '50'))
        rst += main((s[:-2] + '75'))
        return rst
    elif 'X' in s[-2:] or '_' in s[-2:]:
        #Xnum, numX
        # _num, num_
        if 'X' in s[-2:]:
            if s[-2] == 'X': legal_2nds = ['2', '7']
            else: legal_2nds = ['0', '5']
            for l2 in legal_2nds: rst += main(s.replace('X', l2))
        elif '_' in s[-2:]:
            legal_2nds = ['0', '5', '2', '7']
            for l2 in legal_2nds: rst += main(s[:-2] + s[-2:].replace('_', l2))
        return rst
    # _ and X not in the last two number
    if not s[-2:] in ['00', '25', '50', '75']: return 0
    _num = s.count('_')
    X_num = s.count('X')
    if s.startswith('_'):
        rst += 9 * pow(10, (_num - 1)) * (10 if X_num > 0 else 1)
    elif s.startswith('X'): rst += 9 * pow(10, _num)
    elif '_' in s: rst += pow(10, _num) * (10 if X_num > 0 else 1)
    elif 'X' in s: rst += 10
    else: rst += 1 if int(s) % 25 == 0 else 0
    return rst

if __name__ == "__main__":
    s = input()
    rst = main(s)
    print(rst)


'''
Author: your name
Date: 2021-12-10 14:18:39
LastEditTime: 2021-12-13 21:22:52
LastEditors: Please set LastEditors
Description: In User Settings Edit
FilePath: /code_everyWeek/week3.py
'''

def solution_1(input_str):
    if len(input_str) >= 2 and input_str[0] == '0':
        return 0

    if 'X' not in input_str and '_' not in input_str:
        input_num = int(input_str)
        if input_num % 25 == 0:
            return 1
        else:
            return 0

    if len(input_str) == 1:
        if input_str in ['0', 'X', '_']:
            return 1
        else:
            return 0

    X_ = False
    last_two_num = 0

    if input_str[-1] not in ['0', '5', 'X', '_']:
        return 0

    if input_str[-1] == '5':
        if input_str[-2] in ['2', '7']:
            last_two_num = 1
        elif input_str[-2] == 'X':
            last_two_num = 2
            X_ = True # ======
        elif input_str[-2] == '_':
            last_two_num = 2
        else:
            return 0

    if input_str[-1] == '0':
        if input_str[-2] in ['5', '0']:
            last_two_num = 1
        elif input_str[-2] == 'X':
            if input_str[0] != 'X':
                last_two_num = 2 #
            else:
                last_two_num = 1 #
            X_ = True
        elif input_str[-2] == '_':
            last_two_num = 2
            if len(input_str) != 2:
                last_two_num = 2 #
            else:
                last_two_num = 1 #
        else:
            return 0

    if input_str[-1] == 'X':
        if input_str[-2] in ['2', '7']:
            last_two_num = 1 # 'X'=5
            X_ = True
        elif input_str[-2] in ['5', '0']:
            if input_str[0] != 'X':
                last_two_num = 2 # 'X' 0/5
                X_ = True
            else:
                return 0
        elif input_str[-2] == '_':
            if input_str[0] == 'X':
                last_two_num = 2 # 25 / 75
            elif len(input_str) == 2:
                last_two_num = 3 # 25 / 75 / 50
            else:
                last_two_num = 4 # 25 / 75/ 50 / 00
            X_ = True
        elif input_str[-2] == 'X':
            if input_str[0] == 'X':
                return 0
            else:
                last_two_num = 1 # 00
                X_ = True
        else:
            return 0

    if input_str[-1] == '_':
        if input_str[-2] in ['2', '5', '7', '0']:
            last_two_num = 1
        elif input_str[-2] == '_':
            if len(input_str) != 2:
                last_two_num = 4 # 25/75/50/00
            else:
                last_two_num = 3 # 25/75/50
        elif input_str[-2] == 'X':
            if input_str[0] == 'X':
                last_two_num = 3 # 25 / 75 / 50
            else:
                last_two_num = 4
            X_ = True
        else:
            return 0

    if len(input_str) <= 2:
        return last_two_num

    num_of_ = 0
    num_ofX = 0
    for i in range(0, len(input_str)-2):
        if input_str[i] == '_':
            num_of_ += 1
        elif input_str[i] == 'X':
            num_ofX += 1

    if input_str[0] != '_':
        res = pow(10, num_of_) * (10 if num_ofX and not X_ else 1) * last_two_num
    else:
        res = 9 * pow(10, max(num_of_-1, 0)) * (10 if num_ofX and not X_ else 1) * last_two_num

    return res

if __name__ == "__main__":
    input_str = input()
    res = solution_1(input_str)
    print(res)


def can_equal(s, t):
    for i in range(len(s)):
        for j in range(i):
            if s[i] == s[j] == 'X' and t[i].isdigit() and t[j].isdigit() and t[i] != t[j]:
                return False
    return all(c == d or c in '_X' or d in '_X' for c,d in zip(s, t))

s = input()
if len(s) == 1: exit(print(+(s<'1'or':'<s)))
if s[0] == '0': exit(print(0))
try:
    s.index('_'); s.index('X')
    exit(print(+(int(s)%25<1)))
except ValueError: pass
if len(s) == 1: exit(print(1))

if s[-1] not in '05_X': exit(print(0))
elif s[-2] not in '0257_X' or s[-1] not in '05_X': exit(print(0))

if len(s) == 2:
    if s == '__':
        exit(print(3))
    elif s == 'XX':
        exit(print(0))
    elif s[0] in '_X':
        if s[1] == '0':
            exit(print(1))
        elif s[1] == '5':
            exit(print(2))
        elif not s[1].isdigit():
            exit(print(3))
        else:
            exit(print(0)) # redundant
    else:
        exit(print(+(int(s)%25<1))) # redundant

SUFFIXES = ['00'] if s[-2:] == 'XX' else ['00','25','50','75']

ways = 0
for t in SUFFIXES:
    if not can_equal(s[-2:], t): continue
    X = int(t[s[-2:].index('X')]) if 'X' in s[-2:] else 'X'
    S = ''.join(str(X) if c == 'X' else c for c in s)
    if not S[-1].isdigit(): S = S[:-1] + t[-1]
    if not S[-2].isdigit(): S = S[:-2] + t[-2] + S[-1]
    if S[0] == 'X' and X == 0 or S[0] == '0': continue
    w = 10**S.count('_')
    if S[0] == '_': w -= w//10
    if 'X' in S: w *= 10
    ways += w
    # print(f'{w} ways for suffix {t}')
print(ways)


from collections import deque

def lastTwo(s):
    if s == "__":
        return 4
    elif s[0] == "_":
        return 2 if s[1] == "0" or s[1] == "5" else 0#(1 if s[1] == "2" or s[1] == "7" else 0)
    elif s[1] == "_":
        return int(s[0] == "0" or s[0] == "2" or s[0] == "5" or s[0] == "7")
    else:
        return int(int(s) % 25 == 0)
    # return (4 if current[-2:] == "__" else (1 if (current[-1] == "_" and )))

def sPossibleCount(s):
    if "X" in s:
        start = int(s[0] == "X")
        q = ["".join([s[i] if s[i]!="X" else str(x) for i in range(len(s))]) for x in range(start, 10)]
    else:
        q = [s]

    total = 0
    for current in q:
        if "_" not in current[-2:]:
            if (int(current[-2:]) % 25 == 0):
                if "_" not in current:
                    total += 1
                else:
                    total += ((10**current.count("_")) * (10-(current[0] == "_"))) // 10
        else:
            print(current, 10**((current.count("_") - current[-2:].count("_")) - (current[0] == "_")))
            total += max((((10**(current.count("_") - current[-2:].count("_"))) * (10-(current[0] == "_"))) // 10, 1)) * lastTwo(current[-2:])

    return total

s = input()
if s[0] == "0":
    print(int(s == "0"))
elif "_" not in s and "X" not in s:
    print(int((int(s) % 25) == 0))
elif s == "X" or s == "_":
    print(1)
elif s == "0":
    print(1)
elif len(s) == 1:
    print(0)
elif s == "__" or s == "_X" or s == "X_":
    print(3)
else:
    print(sPossibleCount(s))


def divisible_by_25(s):
    n = len(s)
    if n < 2:
        if (s == "0") or (s == "_") or (s == "X"):
            return 1
        return 0

    b = s[:n - 2]
    e = s[n - 2:]
    valid_endings = ["25", "50", "75"]
    if n >= 3:
        valid_endings = ["00", "25", "50", "75"]

    total = 0
    for valid_ending in valid_endings:
        valid, x = can_be_made(valid_ending, e)
        if not valid:
            continue

        total += count_variants(x, b)

    return total

def can_be_made(valid_ending, e):
    if e == "__":
        return True, None

    for underscore in ["0", "2", "5", "7"]:
        for x in ["X", "0", "2", "5", "7"]:
            e_ = e.replace("X", x)
            e_ = e_.replace("_", underscore)
            if e_ == valid_ending:
                if x == "X":
                    x = None
                return True, x
    return False, None

def count_variants(x, b):
    if b == "":
        return 1

    if b[0] == "0":
        return 0

    total = 1
    if b[0] == "X":
        if x == 0:
            return 0
        if x is None:
            total *= 9
            x = 1
    if b[0] == "_":
        total *= 9

    for ch in b[1:]:
        if ch == "_":
            total *= 10
        if ch == "X":
            if x is None:
                total *= 10
                x = 1

    return total

s = input()
print(divisible_by_25(s))


mod=10**9+7
N,M,K,R,C=map(int,input().split())
AX,AY,BX,BY=map(int,input().split())
Z=0
if AX+R>BX and AY+C>BY:
  Z=(AX+R-BX)*(AY+C-BY)
V=N*M-R*C*2+Z
print(pow(K,V+R*C-Z,mod))


n=int(input())
print(n**2-1)
# Wed Apr 20 2022 06:23:32 GMT+0000 (Coordinated Universal Time)


n = int(input())
print(2**n-1)
# Wed Apr 20 2022 06:23:32 GMT+0000 (Coordinated Universal Time)


n = int(input())
for i in range(n):
    x = int(input())-1
    print(2 ** x)
# Wed Apr 20 2022 06:31:57 GMT+0000 (Coordinated Universal Time)


#oh yeah you said i submitted the same code? here i change my code by adding a comment
n = int(input())
print(2**n - 1)


t=int(input())

def win(n):
    if n==1:
        k=1
    else:
        k=(2*n)-1

    return k

for i in range(0,t):
    n=int(input())
    k=win(n)
    print(k)


import sys

# Mike change this based on the codeforces problem.
linesPerTest = 1

testArguments = []

i = 0
totalLines = 1

# Read all the lines from stdin, write them to testCasesUnformatted.
while i <= totalLines:
    line = sys.stdin.readline().rstrip('\n')
    if i == 0:
    	totalLines = linesPerTest * int(line)
    else:
        testArguments.append(line)
    i += 1

# Group the test arguments into test cases.
testCases = []
for j in range(0, len(testArguments), linesPerTest):
	testCases.append(testArguments[j:j + linesPerTest])

def f(testArguments):
    n = int(testArguments[0])
    if n == 1:
        return 1
    else:
        return 2**n / 2 - 1

for testCase in testCases:
	print(f(testCase))


for _ in range(int(input())):
    n=int(input())
    a=[]
    for i in range(1, n**2+1):
        a.append(i)
    b=[]
    while len(a)>1:
        for i in range(0,len(a)-1,2):
            if (a[i]+a[i+1])%2==0:
                b.append(a[i+1])
            else:
                b.append(a[i])
        a=b
        b=[]
    print(a[0])


import sys

for line in sys.stdin:
    print(2 ** int(line) - 1)


def play_off(n):
    h=2**n
    k=2
    if n%2==1:
        k=1
    while k!=0:
        h-=1
        k-=1
    return h

t=int(input())
for i in range(t):
    n=int(input())
    print(play_off(n))


test_cases = int(input())

for i in range(test_cases):
    n = int(input())
    passed_first_stage = list(range(1, n ** 2, 2))

    for j in range(n - 1):
        passed_first_stage = list(set(passed_first_stage))
        for k in range(len(passed_first_stage) - 1):
            if k % 2 == 0:
                if (passed_first_stage[k] + passed_first_stage[k + 1]) % 2 == 0:
                    passed_first_stage[k] = passed_first_stage[k + 1]
                else:
                    passed_first_stage[k + 1] = passed_first_stage[k]

    if len(passed_first_stage) == 0:
        print(1)
    else:
        print(passed_first_stage[0])


s = int(input())
for _ in range(s):
  n = int(input())
  print(n ** 2 - 1)


t = int(input())
for _ in range(t):
    n = int(input())
    print(n-1)


# function uses recursion to compute winner athlete depending on conditions
def game (test) :
    length = len(test)
    if length == 1 :
        print(f"{test[0]}") #printing the winner athlete
        return 0
    j = 1
    while j <= length/2 :
        i = j - 1
        if (test[i] + test[j]) % 2  == 0 :
            if test[i] >= test[j] :
                del(test[j])
            else :
                del(test[i])
        elif test[i] >= test[j] :
            del(test[i])
        else :
            del(test[j])
        j += 1
    return game (test)
athlete = int(input()) # promping the number of stages
my_list = []
for i in range(1,(2**athlete+1),1) :
    my_list.append(i)
game(my_list)


t = int(input())
for i in range(t):
    n = int(input())
    x = (2^n)-1
    print(x)


import sys
input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return(int(input()))
def inlt():
    return(list(map(int,input().split())))
def insr():
    s = input()
    return(list(s[:len(s) - 1]))
def invr():
    return(map(int,input().split()))

def solve():
    n=inp()
    prev=0
    for i in range(2,n+1):
        #
        first=prev

        second=first+2**(i-1)
        s=first+second
        if s%2==1:
            # odd
            prev=first
        else:
            prev=second

    return prev+1

print(solve())


T = int(input())
while T:
    T -= 1
    N = int(input())
    # S = input()
    # c = input()
    # arr = list(map(int, input().split()))
    # l, r, a = map(int, input().split())

    if N > 19:
        print("NO")
    else:
        print("YES")
        for i in range(N):
            print(3**i, end=" ")
        print()


t=int(input())
for i in range(t):
    n=int(input())
print("7")
print("1")


n = int(input())
for _ in range(n):
    m = int(input())
    lst = [i for i in range(1, 2**n)]
    print(lst[n - 2])


if __name__ == "__main__":
	for _ in range(int(input())):
		n = int(input())
		i = 0
		arr = [j for j in range(1, 2**n+1)]

		while( len(arr) > 1 ):
			if( (arr[i]+arr[i+1])%2 == 0 ):
				arr.pop(i)
			else:
				arr.pop(i+1)
			i += 1

			if( i >= len(arr) ):
				i = 0

		print( arr[0] )


if __name__ == "__main__":
	for _ in range(int(input())):
		n = int(input())
		print( 2**(n-1) )


t = int(input())
for i in range(1,t) :
    x = int(input())
    print(2 ** x - 1)


n_testcases = int(input())
testcases = [0 for i in range(n_testcases)]
for i in range(n_testcases):
    testcases[i] = int(input())

winner = []
for i in testcases:
    winner.append(2**i-1)

print(winner)


n=int(input())
if n==1:
    print(1)
else:
    print(2**n-1)


for i in range(int(input())):
    n=int(input())
    if(n%2!=0):
        print(2**n - 1)
    else:
        print(n-1)


for i in range(int(input())):
    n=int(input())
    res=[x for x in range(1,2**n+1)]
    while(len(res)!=1):
        x=[]
        for i in range(len(res)-1,0,-2):
            print(res[i],res[i-1])
            if((res[i]+res[i-1])%2==0):
                x.append(max(res[i],res[i-1]))
            else:
                x.append(min(res[i],res[i-1]))
        print(res,x)
        res=x
    print(res[0])


def playoff(arry):
    if(len(arry)>1):
        arr=[]
        i=0
        while(i<len(arry)):
            if((arry[i]+arry[i+1])%2!=0):
                arr.append(arry[i])
            else:
                arr.append(arry[i+1])
            i+=2
        playoff(arr)
    else:
        print(arry[0])
n=int(input())
arr1=[]
for i in range(2**n):
    arr1.append(i+1)
playoff(arr1)


t = int(input())
while t != 0:
    n = int(input())
    x = pow(n, 2)
    print(x-1)
    t -= 1


n = int(input())
for _ in range(n):
    x=int(input())
    if(x == 1):
        print(1)
    else:
        print(2*x+1)


#----------------------------IMPORTING LIBRARIES----------------------------#
import gc
import math
from math import log2
import heapq
from math import floor, ceil
from collections import deque
from posixpath import curdir
from re import L
import sys
from collections import Counter
#----------------------------LAMBDAS AND DEFAULT----------------------------#
I = lambda:list(map(int,input().split()))
MAP = lambda:map(int, input().split())
input = sys.stdin.readline
sys.setrecursionlimit(10000)

MOD = 998244353
#-----------------------------STANDARD FUNCTIONS----------------------------#
def lcm(a, b):
    return abs(a*b) // math.gcd(a, b)

def gcd(a, b):
    if b == 0:
        return a
    return gcd(b, a%b)

def isSubsequence(s, t):
    for i in range (0, len(s)):
        try:
            index = t.index(s[i])
        except ValueError:
            return False
        t = t[index+1:]
    return True

def bisect_right(a, x):
        lo, hi = 0, len(a)
        while lo < hi:
            mid = lo + (hi - lo) // 2
            if a[mid] > x: hi = mid
            else: lo = mid + 1
        return lo

def bisect_left(a, x):
    lo, hi = 0, len(a)
    while lo < hi:
        mid = lo + (hi - lo) // 2
        if a[mid] < x: lo = mid + 1
        else: hi = mid
    return lo

def binary_search(nums, target):
    left, right = 0, len(nums) - 1
    while left <= right:
        pivot = left + (right - left) // 2
        if nums[pivot] == target:
            return pivot
        if target < nums[pivot]:
            right = pivot - 1
        else:
            left = pivot + 1
    return -1

#------------------------------HELPER FUNCTION------------------------------#
def prefixSum(arr):
    dp = [arr[0]]
    arrLen = len(arr)
    for i in range(1, arrLen): dp.append(dp[-1] + arr[i])
    return dp

def suffixSum(arr):
    arrLen = len(arr)
    dp = [0] * arrLen
    dp[-1] = arr[-1]
    for i in range(arrLen-2, -1, -1): dp[i] = dp[i+1] + arr[i]
    return dp

def fun():
    return

MAX = 10**6 + 2

def solve():
    N = int(input())
    if N == 1:
        print(1)
    elif N == 2:
        print(2)
    else:
        print(2**N-1)

#---------------------------------DRIVER CODE--------------------------------#
TC = int(input())
#TC = 1
for testcases in range(TC):
    solve()


t=int(input())
for i in range(t):
    n=int(input())
    print((n**2)-1)


def race(a):
    wn=""
    for i in range(1,len(a),2):
        if (a[i-1]+a[i])%2==0:
            wn+=str(a[i])
            wn+=' '
        else:
            wn+=str(a[i-1])
            wn+=' '
    wn=wn.split()
    nwn=[]
    for i in range(len(wn)):
        nwn.append(int(wn[i]))

    return nwn

t=int(input())
n=t**3
a=[]
for i in range(1,n+1):
    a.append(i)

nnl=[]
for i in range(t):
   d=int(input())
   nnl.append(d)

#print(a)
while len(a)>1:
    a=race(a)
print(a[0])

while len(nnl)>1:
    nnl=race(nnl)

print(nnl[0])


for i in range(int(input())):
    n = int(input())
    if n%2 == 0:
        print(n-1)
    else:
        print(n)


def main():
    n = int(input())
    print(2**n-1)

if __name__ == '__main__':
    main()


for _ in range(int(input())):
    n=int(input())
    print(1<<n-1)


n=int(input())
for i in range(n):
    m=int(input())
    if(m%2==0):
        print(2**m)
    else:
        print((2**m)-1)


t = int(input())

N = []

for i in range(t):
    n = int(input())
    N.append(n-1)

for n in N:
    print(n)


for _ in range(int(input())):
    a=int(input())
    print(2*a-1)


t=int(input())
for i in range(t):
    n=int(input())
    n=2**n
    l=[]
    for i in range(1,n+1):
        l.append(i)
    l1=[]
    while True:
        if len(l)==1:
            break
        else:
            i=0
            while i<len(l):
                s=l[i]+l[i+1]
                if s%2==0:
                    l1.append(l[i+1])
                else:
                    l1.append(l[i])
                i+=2
            l=l1.copy()
            l1=[]
    print(l[0])


t = input()
for i in (1,t):
    n = int(input())
    print(2**n-1)


import sys

def _input_iter():
    for line in sys.stdin:
        for part in line.strip().split(' '):
            stripped = part.strip()
            if stripped:
                yield stripped

stream = _input_iter()

def read_int():
    return int(next(stream))

def read_str():
    return next(stream)

def run():
    n = read_int()
    print({
              1: 1,
              2: 1,
          }.get(n, 2 ** n - 1))

def main():
    t = read_int()
    for _ in range(t):
        run()

if __name__ == '__main__':
    main()


game_nums = int(input())

for i in range(game_nums):
    g = int(input())
    print(g **2 - 1)


from sys import stdin
inp = [*map(int, stdin.read().strip().splitlines())]

for i in range(inp[0]):
    if i == 1:
        print(1)
    else:
        print((2**inp[1:][i])-1)


m = int(input())
for i in range(m):
    n = int(input())
    x = (m**n)-1
    print(x)
    print(n-m)


import itertools
import heapq
import collections
import math
import sys

input = sys.stdin.readline

############ ---- Input Functions ---- ############
def inp():
    return (int(input()))

def inlt():
    return (list(map(int, input().split())))

def insr():
    s = input()
    return (list(s[:len(s) - 1]))

def invr():
    return (map(int, input().split()))

def inis():
    return (input().split())

def stlt():
    return list(map(str, input().split()))

###################################################

# # Code to find top 3 elements and their counts
# # using most_common
#
# arr = [1, 3, 4, 1, 2, 1, 1, 3, 4, 3, 5, 1, 2, 5, 3, 4, 5]
# counter = Counter(arr)
# top_three = counter.most_common()
# print(sorted(top_three))
#
#
# # Python code to find 3 largest and 4 smallest
# # elements of a list.
#
# grades = [110, 25, 38, 49, 20, 95, 33, 87, 80, 90, 110]
# print(heapq.nlargest(3, grades))
# print(heapq.nsmallest(4, grades))

########################################################################
#-----------------------------Functions--------------------------------#
########################################################################

def SieveOfEratosthenes(n):
    prime = [True for i in range(n + 1)]
    p = 2
    l = []
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * p, n + 1, p):
                prime[i] = False
        p += 1
    for p in range(2, n + 1):
        if prime[p]:
            l.append(p)
    return l

def isPrime(n):
    prime_flag = 0

    if n > 1:
        for i in range(2, int(math.sqrt(n)) + 1):
            if n % i == 0:
                prime_flag = 1
                break
        if prime_flag == 0:
            return True
        else:
            return False
    else:
        return False

def gcdofarray(a):
    x = 0
    for p in a:
        x = math.gcd(x, p)
    return x

# method to print the divisors
def printDivisors(n):
    # Note that this loop runs till square root
    i = 1
    ans = []
    while i <= math.sqrt(n):

        if (n % i == 0):

            # If divisors are equal, print only one
            if (n / i == i):
                ans.append(i)
            else:
                # Otherwise print both
                ans.append(i)
                ans.append(n // i)
        i = i + 1
    ans.sort()
    return ans

def CountDivisors(n):
    # Note that this loop runs till square root
    i = 1
    ans = []
    while i <= math.sqrt(n):

        if (n % i == 0):

            # If divisors are equal, print only one
            if (n / i == i):
                ans.append(i)
            else:
                # Otherwise print both
                ans.append(i)
                ans.append(n // i)
        i = i + 1
    ans.sort()
    return len(ans)

def binaryToDecimal(n):
    return int(n, 2)

def countTriplets(a, n):
    s = set()
    for i in range(n):
        s.add(a[i])
    count = 0
    for i in range(n):
        for j in range(i + 1, n, 1):
            xr = a[i] ^ a[j]
            if xr in s and xr != a[i] and xr != a[j]:
                count += 1
    return int(count // 3)

def generate_twin_prime(n):
    a = 0
    for i in range(1, n + 1):
        j = i + 2
        if isPrime(i) and isPrime(j):
            if 2 ^ (i ^ j) == 0:
                a += 1
    return a

def smallestDivisor(n):
    if (n % 2 == 0):
        return 2
    i = 3
    while (i * i <= n):
        if (n % i == 0):
            return i
        i += 2
    return n

def countOdd(L, R):
    N = (R - L) // 2

    # if either R or L is odd
    if (R % 2 != 0 or L % 2 != 0):
        N += 1

    return N

def isPalindrome(s):
    return s == s[::-1]

def sufsum(test_list):
    test_list.reverse()
    res = [sum(test_list[: i + 1]) for i in range(len(test_list))]
    return res

def prsum(lst):
    return (list(itertools.accumulate(lst)))

def badachotabadachota(nums):
    nums.sort()
    i = 0
    j = len(nums) - 1
    ans = []
    cc = 0
    while len(ans) != len(nums):
        if cc % 2 == 0:
            ans.append(nums[j])
            j -= 1
        else:
            ans.append(nums[i])
            i += 1
        cc += 1
    return ans

# ########################################################################
# #-----------------------------Code Here--------------------------------#
# ########################################################################

for _ in range(inp()):
    # n = inp()
    # u = inlt()
    # s = inlt()
    # d = {}
    # ans = []
    # for i in range(n):
    #     if u[i] in d:
    #         d[u[i]].append(s[i])
    #     else:
    #         d[u[i]] = []
    #         d[u[i]].append(s[i])
    # print(d)
    n = inp()
    if n == 1:
        print(1)
    else:
        print(n ** 2 - 1)


import math

t=int(input())
while(t > 0):
  t-=1
  n = int(input())
  z = math.pow(2,n)
  print(z-1)


from sys import stdin, stdout

t = int(stdin.readline())

"""
range(1,2**n+1)

1,3
5,7  ==> 3,7   => 7,15 => 15
9,11     11,15   (largest) (largest)
13,[15]  (largest)
(largest)

Solution
2. Max(odds)

2**4 -1
"""

for _ in range(t):
    n = int(stdin.readline())
    stdout.write(str(2**n-1))


# -*- coding: utf-8 -*-
"""
Created on Mon Mar 14 19:30:51 2022

@author: Ajay Varma
"""

for i in range(int(input())):
    x= int(input())
    print(2**x)


t = int(input())

for i in range(t):
    n = int(input())
    if n % 2 == 0:
        print(n - 1)
    else:
        print(2**n - 1)


from cmath import inf
from re import L, T
from telnetlib import TN3270E
def swap(a,b):
    a = a^b
    b = a^b
    a = a^b
    return a,b
    # call using a,b = swap(a,b)
def even(a):
    if a&1:
        return False
    return True
def gcd(x, y):
   while(y):
       x, y = y, x % y
   return x

def lcm(x, y):
   lcm = (x*y) // gcd(x,y)
   return lcm

# it will return index of "key" in "sorted list".
def BS_elemPosi(low, high, key, li):
    while low<high:
        mid = (low+high)//2
        if key>=li[mid]:
            low = mid+1
        else:
            high = mid
    return low

def swap(arr, i,j):
    tmp = arr[i]
    arr[i] = arr[j]
    arr[j] = tmp

def perm(li,arr, curr_indx=0):
    if curr_indx==len(arr)-1:
        li.append("".join(arr))
    for i in range(curr_indx,len(arr)):
        swap(arr,curr_indx,i)
        perm(li,arr,curr_indx+1)
        swap(arr,curr_indx,i)

import sys
input = sys.stdin.readline
###########################(CODE)#######################################
for _ in range(int(input())):
    n = int(input())
    if n==1:
        print(1)
    elif n%2==0:
        print(n*2-1)
    else:
        print(n*2+1)
#######################################################################


# SHRi GANESHA    author: Kunal Verma #
import os
import sys
from bisect import bisect_left
from collections import deque
from heapq import heapify, heappush, heappop
from io import BytesIO, IOBase
from math import inf, gcd

def lcm(a, b):
    return (a * b) // gcd(a, b)

'''
    mod = 10 ** 9 + 7
    fac = [1]
    for i in range(1, 2 * 10 ** 5 + 1):
        fac.append((fac[-1] * i) % mod)
    fac_in = [pow(fac[-1], mod - 2, mod)]
    for i in range(2 * 10 ** 5, 0, -1):
        fac_in.append((fac_in[-1] * i) % mod)
    fac_in.reverse()
    def comb(a, b):
        if a < b:
            return 0
        return (fac[a] * fac_in[b] * fac_in[a - b]) % mod
'''
# MAXN = 10000004
# spf = [0 for i in range(MAXN)]
# adj = [[] for i in range(MAXN)]
def sieve():
    global spf, adj, MAXN
    spf[1] = 1
    for i in range(2, MAXN):
        spf[i] = i

    for i in range(2, MAXN):
        if i * i > MAXN:
            break
        if (spf[i] == i):
            for j in range(i * i, MAXN, i):
                if (spf[j] == j):
                    spf[j] = i
def getdistinctFactorization(n):
    global adj, spf, MAXN
    for i in range(1, n + 1):
        index = 1
        x = i
        if (x != 1):
            adj[i].append(spf[x])
        x = x // spf[x]
        while (x != 1):
            if (adj[i][index - 1] != spf[x]):
                adj[i].append(spf[x])
                index += 1
            x = x // spf[x]
def printDivisors(n):
    i = 2
    z = [1, n]
    while i <= sqrt(n):
        if (n % i == 0):
            if (n / i == i):
                z.append(i)
            else:
                z.append(i)
                z.append(n // i)
        i = i + 1
    return z
def create(n, x, f):
    pq = len(bin(n)[2:])
    if f == 0:
        tt = min
    else:
        tt = max
    dp = [[inf] * n for _ in range(pq)]
    dp[0] = x
    for i in range(1, pq):
        for j in range(n - (1 << i) + 1):
            dp[i][j] = tt(dp[i - 1][j], dp[i - 1][j + (1 << (i - 1))])
    return dp
def enquiry(l, r, dp, f):
    if l > r:
        return inf if not f else -inf
    if f == 1:
        tt = max
    else:
        tt = min
    pq1 = len(bin(r - l + 1)[2:]) - 1
    return tt(dp[pq1][l], dp[pq1][r - (1 << pq1) + 1])
def SieveOfEratosthenes(n):
    prime = [True for i in range(n + 1)]
    p = 2
    while (p * p <= n):
        if (prime[p] == True):
            for i in range(p * p, n + 1, p):
                prime[i] = False
        p += 1
    x = []
    for i in range(2, n + 1):
        if prime[i]:
            x.append(i)
    return x

def main():
    for _ in range(int(input())):

        n=int(input())
        n=2**n
        print(n-(n%2)^1)

# Fast IO Region
BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == '__main__':
    main()


for i in range(int(input())):
	a = int(input())
	print((a**2)-1)


def getint():
    return [int(i) for i in input().split()]
def get():
    return int(input())
def getstr():
    return [i for i in input().split()]
def S():
    for test in range(int(input())):
        solve()
import math
import itertools as it
import bisect
import time
import collections as ct

def lower_bound(a,x):
    l=-1
    r=len(a)
    while l+1!=r:
        mid=l+r>>1
        if a[mid]<x:
            l=mid
        else:
            r=mid
    return r
def upper_bound(a,x):
    l=-1
    r=len(a)
    while l+1!=r:
        mid=l+r>>1
        if a[mid]<=x:
            l=mid
        else:
            r=mid
    return r
def solve():
    n=get()
    print(3*n-2)

S()


for _ in range(int(input())):
    n = int(input())
    print(1<<n - 1)


for _ in range(int(input())):
    n = int(input())
    print(n**2-1)


import os
from io import BytesIO, IOBase
import sys
import math
def split(word):
   return [char for char in word]
def ncr(n, r, p):
	# initialize numerator
	# and denominator
	num = den = 1
	for i in range(r):
		num = (num * (n - i)) % p
		den = (den * (i + 1)) % p
	return (num * pow(den,p - 2, p)) % p
def main():
      for i in range(int(input())):
         n=int(input())
         print(n**2-1)
# region fastio
BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

if __name__ == "__main__":
    main()


# ------------------- fast io --------------------
from __future__ import division, print_function
import os
import sys
from io import BytesIO, IOBase
import itertools
if sys.version_info[0] < 3:
    input = raw_input
    range = xrange

    filter = itertools.ifilter
    map = itertools.imap
    zip = itertools.izip
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)

input = lambda: sys.stdin.readline().rstrip("\r\n")
if os.path.exists('input.txt'):
    sys.stdin = open('input.txt','r')
    sys.stdout = open('output.txt','w')

# ----------------- fast io --------------------
from math import *
from itertools import * # chain,groupby,permutations,combinations
from collections import * #deque
from bisect import *
from heapq import *
from random import *

"""

def gcd(x, y):

    while y:
        x, y = y, x % y
    return x

def prod(a, mod=10**9+7):
    ans = 1
    for each in a:
        ans = (ans * each) % mod
    return ans

def lcm(a, b): return a * b // gcd(a, b)

def binary(x, length=16):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y

def powerset(s):
    n=len(s)

    return chain.from_iterable(combinations(s,r) for r in range(1,n))

def binarySearch(arr,x):
    l=0
    r=len(arr)-1
    while l <= r:

        mid = l + (r - l) // 2;
        if arr[mid] == x:
            return mid
        elif arr[mid] < x:
            l = mid + 1
        else:
            r = mid - 1
    return -1

def prime(n): #array of prime numbers
    arr = [1]*(n+1)
    arr[0] = arr[1] = 0
    p=2
    while p*p<=n:
        if arr[p]:
            for i in range(p * 2, n + 1, p):
                arr[i] = 0
            p+=1

    return arr

def prime(n):
    # Returns  a list of primes < n
    sieve = [True] * n
    for i in range(3,int(n**0.5)+1,2):
        if sieve[i]:
            sieve[i*i::2*i]=[False]*((n-i*i-1)//(2*i)+1)
    return [2] + [i for i in range(3,n,2) if sieve[i]]

def palindrome(string,start,end):
    if start==end:
        return True
    if end==1:
        return True
    return string[start]==string[end-1] and palindrome(string,start+1,end-1)

def binomialCoeff(n, k):

    C = [0 for i in range(k+1)]
    C[0] = 1

    for i in range(1, n+1):

        j = min(i, k)
        while (j > 0):
            C[j] = C[j] + C[j-1]
            j -= 1

    return C[k]

def binary_search(array):

    def condition(value) -> bool:
        pass

    left, right = min(search_space), max(search_space) # could be [0, n], [1, n] etc. Depends on problem
    while left < right:
        mid = left + (right - left) // 2
        if condition(mid):
            right = mid
        else:
            left = mid + 1
    return left

prime_dict = {'a': 2, 'b': 3, 'c': 5, 'd': 7, 'e': 11, 'f': 13, 'g': 17, 'h': 19, 'i': 23, 'j': 29, 'k': 31, 'l': 37, 'm': 41, 'n': 43, 'o': 47, 'p': 53, 'q': 59, 'r': 61, 's': 67, 't': 71, 'u': 73, 'v': 79, 'w': 83, 'x': 89, 'y': 97, 'z': 101}

"""

#----# My Functions

inf = float("inf")
mod = 10**9+7
noyes = ["NO","YES"]
yesno = ["YES","NO"]
def aa():
    return int(input())

def bb():
    return list(map(int,input().split()))

def cc():
    s = input()
    return list(s)

def dd():
    return map(int,input().split())

def put(i,val):
    print("Case #",i,":",val)

def swap(arr,i,j):
    arr[i],arr[j] = arr[j],arr[i]

def power(base, exp, mod = mod):
    ans = 1

    while exp:
        lastbit = exp & 1
        if lastbit:
            ans = (ans * base)%(mod)

        base=(base*base)%mod
        exp>>=1

    return ans%mod
#----#

def koi_coding_sikha_do():

    n = aa()
    if n%2==0:
        print(2**n)
    else:
        print(2**n - 1)

onlyone = 0
t=1 if onlyone else int(input())
while(t):

    koi_coding_sikha_do()

    t-=1

"""
__________          __  .__                              __    __             _________
\______   \___.__._/  |_|  |__   ____   ____             \ \   \ \            \_   ___ \     .__         .__
 |     ___<   |  |\   __\  |  \ /  _ \ /    \             \ \   \ \           /    \  \/   __|  |___   __|  |___
 |    |    \___  | |  | |   Y  (  <_> )   |  \            / /   / /           \     \____ /__    __/  /__    __/
 |____|    / ____| |__| |___|  /\____/|___|  /           /_/   /_/             \______  /    |__|        |__|
           \/                \/            \/                                         \/

Unke aakhon me aasu aur chahre pe hasi hai......lagta hai unki lulli unki zip me phasi hai
"""


from collections import Counter, defaultdict, deque
import bisect
import dbm
import sys
import os
from itertools import repeat, permutations
import itertools
import math
import heapq
import random
from sys import stdin, stdout

MOD = 998244353
from io import BytesIO, IOBase

BUFSIZE = 8192

def inp(force_list=False):
    re = list(map(int, input().split()))
    if len(re) == 1 and not force_list:
        return re[0]
    return re

def inst():
    return input().strip()

def gcd(x, y):
   while(y):
       x, y = y, x % y
   return x

def lcm(x, y):
    return x*y/(gcd(x,y))

def qmod(a, b, mod=MOD):
    res = 1
    while b:
        if b&1:
            res = (res*a)%mod
        b >>= 1
        a = (a*a)%mod
        # print b
    return res

def inv(a):
    return qmod(a, MOD-2)

def query(tp, l, r=0):
    if tp==1:
        print("? 1 %d" % (l+1,))
        stdout.flush()
        return inst()
    else:
        if r<l:
            return 0
        print("? 2 %d %d" % (l+1, r+1))
        stdout.flush()
        return inp()

fac = [1]
for i in range(1, 100001):
    fac.append((fac[-1]*i)%MOD)
def C(n, k):
    return fac[n] * inv((fac[k]*fac[n-k])%MOD)%MOD

def lstr(da):
    return ' '.join(map(str, da))

IMX = int(1e16+7)

def my_main():
    # global MOD
    kase = 1#inp()
    pans = []
    cur = []

    for ik in range(kase):
        n, k = inp()
        ans = 0
        for i in range(min(n, k)+1):
            ans += C(n, i)
            ans %= MOD
        print(ans)
    # print('\n'.join(pans))

my_main()


import sys
import os
from io import BytesIO, IOBase
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0
    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None
    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()
    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()
    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)
class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")
sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

def MI(num, mod):
    '''
    This function uses ordinary integer arithmetic implementation of the
    Extended Euclid's Algorithm to find the MI of the first-arg integer
    vis-a-vis the second-arg integer.
    '''
    NUM = num; MOD = mod
    x, x_old = 0, 1
    y, y_old = 1, 0
    while mod:
        q = num // mod
        num, mod = mod, num % mod
        x, x_old = x_old - q * x, x
        y, y_old = y_old - q * y, y
    if num != 1:
        print("\nNO MI. However, the GCD of %d and %d is %u\n" % (NUM, MOD, num))
    else:
        MI = (x_old + MOD) % MOD
        return MI

mod = int(1e9) + 7
n, k = map(int, input().split())
if k == 0:
    print('1')
elif k >= n:
    ans = pow(2, n, mod)
    print(ans)
elif k == n-1:
    ans = pow(2, n, mod)
    ans = (ans - 1 + mod) % mod
    print(ans)
else:
    if n == 1:
        print('2')
    else:
        ans = 1

        numerator = 1
        for i in range(2, n+1):
            numerator *= i
            numerator %= mod

        denominator1 = 1
        denominator2 = 1
        for i in range(2, n):
            denominator2 *= i
            denominator2 %= mod

        extra1 = 2
        extra2 = n-1
        for i in range(1, k+1):
            val1 = MI(denominator1, mod)
            add = numerator*val1
            add %= mod
            val2 = MI(denominator2, mod)
            add *= val2
            add %= mod
            ans += add
            ans %= mod

            denominator1 *= extra1
            denominator1 %= mod

            extra2_inverse = MI(extra2, mod)
            denominator2 *= extra2_inverse
            denominator2 %= mod
        print(ans)


from collections import deque
import sys
input = lambda: sys.stdin.readline().rstrip()
ii = lambda: int(input())
mi = lambda: map(int, input().split())
li = lambda: list(mi())
inf = 2 ** 63 - 1
mod = 10 ** 9 + 7

def solve():
    n, k = mi()
    if k >= n:
        print(pow(2, n, mod))
    else:
        ans = pow(2, n, mod) - (n - k)
        print(ans % mod)

for _ in range(1):
    solve()


# ---------------------------iye ha aam zindegi---------------------------------------------
import math
import random
import heapq,bisect
import sys
from collections import deque, defaultdict
from fractions import Fraction
from itertools import permutations
from collections import defaultdict
mod = 10 ** 9 + 7
mod1 = 998244353
import sys
#sys.setrecursionlimit(10000)
# ------------------------------warmup----------------------------
import os
import sys
from io import BytesIO, IOBase

BUFSIZE = 8192

class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        self._fd = file.fileno()
        self.buffer = BytesIO()
        self.writable = "x" in file.mode or "r" not in file.mode
        self.write = self.buffer.write if self.writable else None

    def read(self):
        while True:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            if not b:
                break
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines = 0
        return self.buffer.read()

    def readline(self):
        while self.newlines == 0:
            b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
            self.newlines = b.count(b"\n") + (not b)
            ptr = self.buffer.tell()
            self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr)
        self.newlines -= 1
        return self.buffer.readline()

    def flush(self):
        if self.writable:
            os.write(self._fd, self.buffer.getvalue())
            self.buffer.truncate(0), self.buffer.seek(0)

class IOWrapper(IOBase):
    def __init__(self, file):
        self.buffer = FastIO(file)
        self.flush = self.buffer.flush
        self.writable = self.buffer.writable
        self.write = lambda s: self.buffer.write(s.encode("ascii"))
        self.read = lambda: self.buffer.read().decode("ascii")
        self.readline = lambda: self.buffer.readline().decode("ascii")

sys.stdin, sys.stdout = IOWrapper(sys.stdin), IOWrapper(sys.stdout)
input = lambda: sys.stdin.readline().rstrip("\r\n")

#----------------------------------------------iye ha aam zindegi-----------------------------------

class SegmentTree:
    def __init__(self, data, default=-3*10**9, func=lambda a, b: max(a,b)):
        """initialize the segment tree with data"""
        self._default = default
        self._func = func
        self._len = len(data)
        self._size = _size = 1 << (self._len - 1).bit_length()

        self.data = [default] * (2 * _size)
        self.data[_size:_size + self._len] = data
        for i in reversed(range(_size)):
            self.data[i] = func(self.data[i + i], self.data[i + i + 1])

    def __delitem__(self, idx):
        self[idx] = self._default

    def __getitem__(self, idx):
        return self.data[idx + self._size]

    def __setitem__(self, idx, value):
        idx += self._size
        self.data[idx] = value
        idx >>= 1
        while idx:
            self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
            idx >>= 1

    def __len__(self):
        return self._len

    def query(self, start, stop):
        if start == stop:
            return self.__getitem__(start)
        stop += 1
        start += self._size
        stop += self._size

        res = self._default
        while start < stop:
            if start & 1:
                res = self._func(res, self.data[start])
                start += 1
            if stop & 1:
                stop -= 1
                res = self._func(res, self.data[stop])
            start >>= 1
            stop >>= 1
        return res

    def __repr__(self):
        return "SegmentTree({0})".format(self.data)

# -------------------------------iye ha chutiya zindegi-------------------------------------
class SortedList:
    def __init__(self, iterable=[], _load=200):
        """Initialize sorted list instance."""
        values = sorted(iterable)
        self._len = _len = len(values)
        self._load = _load
        self._lists = _lists = [values[i:i + _load] for i in range(0, _len, _load)]
        self._list_lens = [len(_list) for _list in _lists]
        self._mins = [_list[0] for _list in _lists]
        self._fen_tree = []
        self._rebuild = True

    def _fen_build(self):
        """Build a fenwick tree instance."""
        self._fen_tree[:] = self._list_lens
        _fen_tree = self._fen_tree
        for i in range(len(_fen_tree)):
            if i | i + 1 < len(_fen_tree):
                _fen_tree[i | i + 1] += _fen_tree[i]
        self._rebuild = False

    def _fen_update(self, index, value):
        """Update `fen_tree[index] += value`."""
        if not self._rebuild:
            _fen_tree = self._fen_tree
            while index < len(_fen_tree):
                _fen_tree[index] += value
                index |= index + 1

    def _fen_query(self, end):
        """Return `sum(_fen_tree[:end])`."""
        if self._rebuild:
            self._fen_build()

        _fen_tree = self._fen_tree
        x = 0
        while end:
            x += _fen_tree[end - 1]
            end &= end - 1
        return x

    def _fen_findkth(self, k):
        """Return a pair of (the largest `idx` such that `sum(_fen_tree[:idx]) <= k`, `k - sum(_fen_tree[:idx])`)."""
        _list_lens = self._list_lens
        if k < _list_lens[0]:
            return 0, k
        if k >= self._len - _list_lens[-1]:
            return len(_list_lens) - 1, k + _list_lens[-1] - self._len
        if self._rebuild:
            self._fen_build()

        _fen_tree = self._fen_tree
        idx = -1
        for d in reversed(range(len(_fen_tree).bit_length())):
            right_idx = idx + (1 << d)
            if right_idx < len(_fen_tree) and k >= _fen_tree[right_idx]:
                idx = right_idx
                k -= _fen_tree[idx]
        return idx + 1, k

    def _delete(self, pos, idx):
        """Delete value at the given `(pos, idx)`."""
        _lists = self._lists
        _mins = self._mins
        _list_lens = self._list_lens

        self._len -= 1
        self._fen_update(pos, -1)
        del _lists[pos][idx]
        _list_lens[pos] -= 1

        if _list_lens[pos]:
            _mins[pos] = _lists[pos][0]
        else:
            del _lists[pos]
            del _list_lens[pos]
            del _mins[pos]
            self._rebuild = True

    def _loc_left(self, value):
        """Return an index pair that corresponds to the first position of `value` in the sorted list."""
        if not self._len:
            return 0, 0

        _lists = self._lists
        _mins = self._mins

        lo, pos = -1, len(_lists) - 1
        while lo + 1 < pos:
            mi = (lo + pos) >> 1
            if value <= _mins[mi]:
                pos = mi
            else:
                lo = mi

        if pos and value <= _lists[pos - 1][-1]:
            pos -= 1

        _list = _lists[pos]
        lo, idx = -1, len(_list)
        while lo + 1 < idx:
            mi = (lo + idx) >> 1
            if value <= _list[mi]:
                idx = mi
            else:
                lo = mi

        return pos, idx

    def _loc_right(self, value):
        """Return an index pair that corresponds to the last position of `value` in the sorted list."""
        if not self._len:
            return 0, 0

        _lists = self._lists
        _mins = self._mins

        pos, hi = 0, len(_lists)
        while pos + 1 < hi:
            mi = (pos + hi) >> 1
            if value < _mins[mi]:
                hi = mi
            else:
                pos = mi

        _list = _lists[pos]
        lo, idx = -1, len(_list)
        while lo + 1 < idx:
            mi = (lo + idx) >> 1
            if value < _list[mi]:
                idx = mi
            else:
                lo = mi

        return pos, idx

    def add(self, value):
        """Add `value` to sorted list."""
        _load = self._load
        _lists = self._lists
        _mins = self._mins
        _list_lens = self._list_lens

        self._len += 1
        if _lists:
            pos, idx = self._loc_right(value)
            self._fen_update(pos, 1)
            _list = _lists[pos]
            _list.insert(idx, value)
            _list_lens[pos] += 1
            _mins[pos] = _list[0]
            if _load + _load < len(_list):
                _lists.insert(pos + 1, _list[_load:])
                _list_lens.insert(pos + 1, len(_list) - _load)
                _mins.insert(pos + 1, _list[_load])
                _list_lens[pos] = _load
                del _list[_load:]
                self._rebuild = True
        else:
            _lists.append([value])
            _mins.append(value)
            _list_lens.append(1)
            self._rebuild = True

    def discard(self, value):
        """Remove `value` from sorted list if it is a member."""
        _lists = self._lists
        if _lists:
            pos, idx = self._loc_right(value)
            if idx and _lists[pos][idx - 1] == value:
                self._delete(pos, idx - 1)

    def remove(self, value):
        """Remove `value` from sorted list; `value` must be a member."""
        _len = self._len
        self.discard(value)
        if _len == self._len:
            raise ValueError('{0!r} not in list'.format(value))

    def pop(self, index=-1):
        """Remove and return value at `index` in sorted list."""
        pos, idx = self._fen_findkth(self._len + index if index < 0 else index)
        value = self._lists[pos][idx]
        self._delete(pos, idx)
        return value

    def bisect_left(self, value):
        """Return the first index to insert `value` in the sorted list."""
        pos, idx = self._loc_left(value)
        return self._fen_query(pos) + idx

    def bisect_right(self, value):
        """Return the last index to insert `value` in the sorted list."""
        pos, idx = self._loc_right(value)
        return self._fen_query(pos) + idx

    def count(self, value):
        """Return number of occurrences of `value` in the sorted list."""
        return self.bisect_right(value) - self.bisect_left(value)

    def __len__(self):
        """Return the size of the sorted list."""
        return self._len

    def __getitem__(self, index):
        """Lookup value at `index` in sorted list."""
        pos, idx = self._fen_findkth(self._len + index if index < 0 else index)
        return self._lists[pos][idx]

    def __delitem__(self, index):
        """Remove value at `index` from sorted list."""
        pos, idx = self._fen_findkth(self._len + index if index < 0 else index)
        self._delete(pos, idx)

    def __contains__(self, value):
        """Return true if `value` is an element of the sorted list."""
        _lists = self._lists
        if _lists:
            pos, idx = self._loc_left(value)
            return idx < len(_lists[pos]) and _lists[pos][idx] == value
        return False

    def __iter__(self):
        """Return an iterator over the sorted list."""
        return (value for _list in self._lists for value in _list)

    def __reversed__(self):
        """Return a reverse iterator over the sorted list."""
        return (value for _list in reversed(self._lists) for value in reversed(_list))

    def __repr__(self):
        """Return string representation of sorted list."""
        return 'SortedList({0})'.format(list(self))
#-----------------------------sortedlist--------------------------------------------------------------
class Factorial:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorials = [1, 1]
        self.invModulos = [0, 1]
        self.invFactorial_ = [1, 1]

    def calc(self, n):
        if n <= -1:
            print("Invalid argument to calculate n!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.factorials):
            return self.factorials[n]
        nextArr = [0] * (n + 1 - len(self.factorials))
        initialI = len(self.factorials)
        prev = self.factorials[-1]
        m = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = prev * i % m
        self.factorials += nextArr
        return self.factorials[n]

    def inv(self, n):
        if n <= -1:
            print("Invalid argument to calculate n^(-1)")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        p = self.MOD
        pi = n % p
        if pi < len(self.invModulos):
            return self.invModulos[pi]
        nextArr = [0] * (n + 1 - len(self.invModulos))
        initialI = len(self.invModulos)
        for i in range(initialI, min(p, n + 1)):
            next = -self.invModulos[p % i] * (p // i) % p
            self.invModulos.append(next)
        return self.invModulos[pi]

    def invFactorial(self, n):
        if n <= -1:
            print("Invalid argument to calculate (n^(-1))!")
            print("n must be non-negative value. But the argument was " + str(n))
            exit()
        if n < len(self.invFactorial_):
            return self.invFactorial_[n]
        self.inv(n)  # To make sure already calculated n^-1
        nextArr = [0] * (n + 1 - len(self.invFactorial_))
        initialI = len(self.invFactorial_)
        prev = self.invFactorial_[-1]
        p = self.MOD
        for i in range(initialI, n + 1):
            prev = nextArr[i - initialI] = (prev * self.invModulos[i % p]) % p
        self.invFactorial_ += nextArr
        return self.invFactorial_[n]

class Combination:
    def __init__(self, MOD):
        self.MOD = MOD
        self.factorial = Factorial(MOD)

    def ncr(self, n, k):
        if k < 0 or n < k:
            return 0
        k = min(k, n - k)
        f = self.factorial
        return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD

# --------------------------------------iye ha combinations ka zindegi---------------------------------
def powm(a, n, m):
    if a == 1 or n == 0:
        return 1
    if n % 2 == 0:
        s = powm(a, n // 2, m)
        return s * s % m
    else:
        return a * powm(a, n - 1, m) % m

# --------------------------------------iye ha power ka zindegi---------------------------------
def sort_list(list1, list2):
    zipped_pairs = zip(list2, list1)

    z = [x for _, x in sorted(zipped_pairs)]

    return z

# --------------------------------------------------product----------------------------------------
def product(l):
    por = 1
    for i in range(len(l)):
        por *= l[i]
    return por

# --------------------------------------------------binary----------------------------------------
def binarySearchCount(arr, n, key):
    left = 0
    right = n - 1

    count = 0

    while (left <= right):
        mid = int((right + left) / 2)

        # Check if middle element is
        # less than or equal to key
        if (arr[mid] <= key):
            count = mid + 1
            left = mid + 1

        # If key is smaller, ignore right half
        else:
            right = mid - 1

    return count

# --------------------------------------------------binary----------------------------------------
def countdig(n):
    c = 0
    while (n > 0):
        n //= 10
        c += 1
    return c
def binary(x, length):
    y = bin(x)[2:]
    return y if len(y) >= length else "0" * (length - len(y)) + y

def countGreater(arr, n, k):
    l = 0
    r = n - 1

    # Stores the index of the left most element
    # from the array which is greater than k
    leftGreater = n

    # Finds number of elements greater than k
    while (l <= r):
        m = int(l + (r - l) / 2)
        if (arr[m] >= k):
            leftGreater = m
            r = m - 1

        # If mid element is less than
        # or equal to k update l
        else:
            l = m + 1

    # Return the count of elements
    # greater than k
    return (n - leftGreater)
#-----------------------------------------------trie-----------------------------------------------
class TrieNode:
    def __init__(self):
        self.children = [None] * 26
        self.isEndOfWord = False
class Trie:
    def __init__(self):
        self.root = self.getNode()
    def getNode(self):
        return TrieNode()
    def _charToIndex(self, ch):
        return ord(ch) - ord('a')
    def insert(self, key):
        pCrawl = self.root
        length = len(key)
        for level in range(length):
            index = self._charToIndex(key[level])
            if not pCrawl.children[index]:
                pCrawl.children[index] = self.getNode()
            pCrawl = pCrawl.children[index]
        pCrawl.isEndOfWord = True
    def search(self, key):
        pCrawl = self.root
        length = len(key)
        for level in range(length):
            index = self._charToIndex(key[level])
            if not pCrawl.children[index]:
                return False
            pCrawl = pCrawl.children[index]
        return pCrawl != None and pCrawl.isEndOfWord
#-----------------------------------------trie---------------------------------
class Node:
    def __init__(self, data):
        self.data = data
        self.count=0
        self.left = None  # left node for 0
        self.right = None  # right node for 1
class BinaryTrie:
    def __init__(self):
        self.root = Node(0)
    def insert(self, pre_xor):
        self.temp = self.root
        for i in range(31, -1, -1):
            val = pre_xor & (1 << i)
            if val:
                if not self.temp.right:
                    self.temp.right = Node(0)
                self.temp = self.temp.right
                self.temp.count+=1
            if not val:
                if not self.temp.left:
                    self.temp.left = Node(0)
                self.temp = self.temp.left
                self.temp.count += 1
        self.temp.data = pre_xor
    def query(self, xor):
        self.temp = self.root
        for i in range(31, -1, -1):
            val = xor & (1 << i)
            if not val:
                if self.temp.left and self.temp.left.count>0:
                    self.temp = self.temp.left
                elif self.temp.right:
                    self.temp = self.temp.right
            else:
                if self.temp.right and self.temp.right.count>0:
                    self.temp = self.temp.right
                elif self.temp.left:
                    self.temp = self.temp.left
            self.temp.count-=1
        return xor ^ self.temp.data
# --------------------------------------------------binary-----------------------------------
n,k=map(int,input().split())
if k>=n:
    print(pow(2,n,mod))
else:
    k=n-k
    ans=pow(2,n,mod)-pow(2,k,mod)+1
    print(ans%mod)


def soch(n,k):
    r,e=max(k,n-k),min(k,n-k)
    ans=1
    ansv=1
    for i in range(r+1,n+1):
        ans*=i
    for i in range(1,e+1):
        ansv*=i
    return ans//ansv
n,k=map(int,input().split())
ans=1
s=1
y=k-(k-n//2)
h=min(n//2+(n%2==1)+1,k+1)
if k<n:
    if k+1>=h:
        for i in range(1,min(h,k+1)):
            s=(s*(n-i+1))//i
            ans+=s%(10**9+7)
            if y>0 and i>y and (h-1)!=i:
                ans+=s
        print(ans%(10**9+7))
    else:
        for i in range(1,n-k):
            s=(s*(n-i+1))//i
            ans+=s%(10**9+7)
            if y>0 and i>y and (h-1)!=i:
                ans+=s
        print(pow(2,n,10**9+7)-ans%(10**9+7))
else:
    print(pow(2,n,10**9+7))


def power(x, y, p):
    res = 1  # Initialize result

    # Update x if it is more
    # than or equal to p
    x = x % p

    if (x == 0):
        return 0

    while (y > 0):

        # If y is odd, multiply
        # x with result
        if ((y & 1) == 1):
            res = (res * x) % p

        # y must be even now
        y = y >> 1  # y = y/2
        x = (x * x) % p

    return res

n, k = map(int, input().split())
p = 10**9+7

res = 1
for i in range(k):
    res += power(2, n-1-i, p)
    res = res % p
print(res)


def corruption(n, k):
    MOD = 10 ** 9 + 7
    lim = min(n, k)
    arr = [[0] * (lim + 1), [0] * (lim + 1)]
    arr[0][0] = 1
    for i in range(1, n + 1):
        arr[i % 2][0] = 1
        for j in range(1, min(lim, i)):
            arr[i % 2][j] = arr[(i - 1) % 2][j - 1] + arr[(i - 1) % 2][j]
        if i <= lim:
            arr[i % 2][i] = 1
    return sum(arr[n % 2][:k + 1]) % MOD

n, k = tuple(map(int, input().split()))
print(corruption(n, k))


def solve():
    mod = 1000000007
    res = [1]
    for i in range(1, 100001):
        res.append(res[i - 1] * 2 % mod)
    n, k = map(int, input().strip().split())

    if k >= n:
        print(res[n])
    elif k + 1 == n:
        print(res[n] - 1)
    else:
        print(res[n - k])

if __name__ == '__main__':
    solve()


import sys
input = lambda: sys.stdin.readline().strip()

a,b = map(int, input().split())
if b>a:
    b=a
ans = pow(2,a,1000000007)-pow(2,(a-b),1000000007)+1
ans %= 1000000007
print(ans)