n, m = map(int, input().split())
max = 10**9+7
x = pow(2,m,max)-1
ans = pow(x,n,max)
print(ans)

#  n,m = input().split
import sys
n,m = map(int,sys.stdin.readline().split())

def fast(x, k):
    if (k == 0):
        return 1;
    xp = fast(x, k // 2)
    if (k % 2 == 0):
        return (xp * xp) % 1000000007
    else:
        return (xp * xp * x) % 1000000007

#  print(((2 ** m - 1) ** n) % 1000000007)
print(fast((fast(2, m) - 1), n))

import sys
input=sys.stdin.readline
n,m=map(int,input().split())
print(pow(2**m-1,n,10**9+7))

n,m=map(int,input().strip().split(" "))
mod=(int)(1e9+7)

print(pow(pow(2,m,mod)-1,n,mod))

mod= 10**9 +7

def power(a,b):
    ans=1
    while(b>0):
        if(b%2==1):
            ans=(ans*a)%mod
        b=b//2
        a=(a*a)%mod
    return ans

(n,m)=[int(x) for x in input().split()]
res=power(2,m)-1
res=power(res,n)
print(res%mod)

mod=1000000007
def powerMod(x,y,p):
    res = 1
    x %= p
    while y > 0:
        if y&1:
            res = (res*x)%p
        y = y>>1
        x = (x*x)%p
    return res
n,m=map(int,input().split())
ans=powerMod(2,m,mod)-1
ans=powerMod(ans,n,mod)
print(ans)

n,m = map(int,input().split())
print(pow(2**m-1,n,(int)(1e9+7)))

def power(x, y) :
    res = 1

    p = 10**9 + 7

    x = x % p

    while (y > 0) :

        if ((y & 1) == 1) :
            res = (res * x) % p

        y = y >> 1
        x = (x * x) % p

    return res

n,m = list(map(int,input().split()))
mod = 10**9 + 7
ans = power(power(2,m)-1,n)

print(ans)

a,b=map(int,input().split())
m=7+10**9
ans=(pow(2,b,m)-1)%m
ans= (pow(ans,a,m))%m
print(ans)

M = 1000000007

def pw(x,y):
  s=1
  while y:
    if y & 1: s=(s*x)%M
    x=(x*x)%M
    y>>=1
  return s

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

print(int(pw(pw(2, m) - 1, n)))

#-*- coding: utf-8 -*-

# int(input())
# [int(inp) for inp in input().split()]

n, m = [int(inp) for inp in input().split()]

result = 1
# for i in range(m):
#     result = (result * 2) % (1000000000 + 7)
# result = (result - 1) % (1000000000 + 7)
# mult = result

result = (pow(2, m, int(1e9) + 7) - 1 ) % (int(1e9) + 7)

# for i in range(n - 1):
    # result = (result * mult) % (1000000000 + 7)
result = pow(result, n, int(1e9) + 7)

print(result)

n, m = [int(i) for i in input().split()]

N = 1000000007;

def exponentiation(bas, exp):
    if (exp == 0):
        return 1;
    if (exp == 1):
        return bas % N;

    t = exponentiation(bas, int(exp / 2));
    t = (t * t) % N;

    if (exp % 2 == 0):
        return t;

    else:
        return ((bas % N) * t) % N;

modulo = exponentiation(2, m) - 1
print(exponentiation(modulo, n))

import sys
import math
def fastmod(b,e,m):
    result = 1
    while e!=0:
        if (e&1) == 1:
            result = (result * b) % m
        e >>= 1
        b = (b*b) % m
    return result

if __name__ == '__main__':
    input = sys.stdin.readline
    MOD = int(1e9+7)
    a,b=map(int,input().split())
    print(int(fastmod(fastmod(2,b,MOD)-1,a,MOD)))

mod = 1000000007

def powm(b,p):
    if p == 0:
        return 1
    if p == 1:
        return b
    if p%2 == 1:
        res = powm(b,int(p/2))%mod
        res = (res*res)%mod
        res = (res*b)%mod

    if p%2 == 0:
        res = powm(b,int(p / 2)) % mod
        res = (res * res) % mod

    return res%mod

def main():
    n,m = (int(x) for x in input().split())
    bb = powm(2,m)-1
    print(powm(bb,n))

if __name__ == '__main__':
    main()

def solve(a,b):
    mod = (10**9) + 7
    ans = pow(pow(2,b,mod)-1,a,mod)
    return ans
a,b = map(int,input().split())
print(solve(a,b))

n,m = map(int,input().split())
p = 10**9+7
print(pow((pow(2,m,p)-1),n,p))

from sys import stdin,stdout
from collections import defaultdict as df
from collections import deque
import bisect
from itertools import permutations,combinations
n,m=list(map(int,input().split()))
mod=10**9 + 7
print(pow(pow(2,m,mod)-1,n,mod))

from sys import stdin,stdout
I = lambda : map(int,stdin.readline().split())

mod = 10**9 + 7
n,m = I()
print pow((pow(2,m,mod) - 1),n,mod)

c = 10 ** 9 + 7
n, m = map(int, input().split())
res = pow(pow(2, m, c) - 1, n, c)
print(res)

n,k = map(int ,raw_input().split())
mod = (int)(1e9 + 7)
ans = pow(2,k, mod) - 1
ans += mod
ans %= mod;
ans = pow(ans, n, mod)
print ans

n,m = map(int,raw_input().split())
mod = 10**9 + 7
print pow(pow(2,m,mod)-1,n,mod)

from sys import stdin
n,m=map(int,stdin.readline().split())
t=pow(2,m,1000000007)-1
print pow(t,n,1000000007)

n, m = map(int, input().split())
mod = 10**9+7
print(pow(pow(2, m, mod) - 1, n, mod))

delta = [int(x) for x in input().split()]
n = delta[0]
m = delta[1]
# ans = 2**m
# ans-=1
# ans = ans**(n)
# print(ans)

a=2
mod = 1000000007
temp = 1
while m>0:
    if m&1:
        temp = ((temp%mod)*(a%mod)%mod)
    a = ((a%mod)*(a%mod))%mod
    m>>=1

res = 1
a = (temp+mod-1)%mod

while n>0:
    if n&1:
        res = ((res%mod)*(a%mod)%mod)
    a = ((a%mod)*(a%mod))%mod
    n>>=1
print(res)

n,m = map(int, raw_input().split())
p = (int)(1e9+7)
print(pow((pow(2, m) - 1), n, p))

n, m = map(int, raw_input().split())
MOD = 1000000007
def qpow(a, n):
    ret, now = 1, a
    while n:
        if n & 1:
            ret = ret * now % MOD
        n >>= 1
        now = now * now % MOD
    return ret

print qpow(qpow(2, m) - 1, n)

#!/usr/bin/env pypy
from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from random import randint
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
from math import ceil, factorial as fact
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
import sys
import os
import re
sys.setrecursionlimit(9999)
inf = float('inf')
mod = int(1e9) + 7
mod_ = 998244353
N = 5001

'''
Check for special cases (n=1)
One wrong submission = 10 mins penalty!
do smth instead of nothing and stay organized
'''

def c(n, r):
	return fact(n)//(fact(r)*fact(n-r))

def main():
	n, m = map(int, input().split())
	x = (pow(2, m, mod) - 1 + mod) % mod
	print(pow(x, n, mod))

BUFSIZE = 8192
class FastI(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = StringIO()
		self.newlines = 0

	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("\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()
class FastO(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = __pypy__.builders.StringBuilder()
		self.write = lambda s: self._buffer.append(s)

	def flush(self):
		os.write(self._fd, self._buffer.build())
		self._buffer = __pypy__.builders.StringBuilder()
def print(*args, **kwargs):
	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()
def gcd(x, y):
	while y:
		x, y = y, x % y
	return x
sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")
if __name__ == "__main__":
	def bootstrap(cont):
		call, arg = cont.switch()
		while True:
			call, arg = cont.switch(to=continulet(
				lambda _, f, args: f(*args), call, arg))
	cont = continulet(bootstrap)
	cont.switch()
	main()

input = __import__("sys").stdin.readline
presents, boxes = map(int, input().split())
print(pow((2 ** boxes - 1), presents, 1000000007))

'''input
2 2

'''

from bisect import bisect_right as bl
from random import randint as R
RI = lambda : [int(_x) for _x in raw_input().split()]

mod = 10**9 + 7

for _ in range(1):
	a,b = RI()
	ans = pow(2,b,mod)-1
	ans = pow(ans,a,mod)
	print ans%mod

mod = int(1e9+7)
n,m = map(int,raw_input().split(" "))

def fast(a,b):
    ans = 1
    base = a
    while b:
        if b%2:
            ans= (base*ans)%mod
        b/= 2
        base = (base*base)%mod
    return ans

tmp = fast(2,m)-1
print fast(tmp,n)

#!/usr/bin/env python
from __future__ import division, print_function

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 factorial_mod(n, p):
    res = 1
    while n > 1:
        res = (res * (p - 1 if (n // p) % 2 == 1 else 1)) % p
        for i in range(2, (n % p) + 1):
            res = (res * i) % p
        n //= p
    return res % p

def main():
    n, m = map(int, input().split())

    mod = 10 ** 9 + 7

    print(pow((pow(2, m, mod) - 1) % mod, n, mod))

# 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)

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

# endregion

if __name__ == "__main__":
    main()

from sys import stdin

mod = 1000000007

def pow1(x, base):
    sq = 1
    while (base > 0):

        if base % 2:
            base -= 1
            sq = (sq * x) % mod

        base //= 2
        x = (x * x) % mod

    return sq

n, m = map(int, stdin.readline().split())
print(pow1(pow1(2, m) - 1, n))

from __future__ import division, print_function
import sys
mo=10**9+7
m,n=map(int,raw_input().split())

print(pow(pow(2,n,mo)-1,m,mo))

import sys
range = xrange
input = raw_input

MOD = 10**9 + 7

n,m = [int(x) for x in input().split()]

print pow(pow(2, m, MOD) - 1, n, MOD)

xx=1000000007
A,B=[int(j) for j in input().split()]
kk=int(pow(2,B,xx))-1
ll=pow(kk,A,xx)
print(ll)

def power(x, y, p) :
    res = 1
    x = x % p
    if (x == 0) :
        return 0
    while (y > 0) :
        if ((y & 1) == 1) :
            res = (res * x) % p
        y = y >> 1
        x = (x * x) % p

    return res
n, m = [int(p) for p in input().split()]
mod = 10**9+7

temp = power(2, m, mod)
temp -= 1%mod
temp = temp%mod
ans = power(temp, n, mod)
print(ans)

mod = 10**9+7
n,m = map(int,input().split())
ans = pow(2,m,mod) - 1
ans = ans%mod
ans = pow(ans,n,mod)
print(ans)

n,m=map(int,input().split())
mod=1000000007;
y=pow((pow(2,m,mod)-1)%mod,n,mod)
print(y)

x = input()
n = int(x.split(" ")[0])
m = int(x.split(" ")[1])
mox = int(1e9 + 7)

print((pow(((pow(2, m, mox) - 1 + mox) % mox), n, mox)))

mod=1000000007
n,m=map(int,input().split())
x=pow(2,m,mod)
x-=1
p=pow(x,n,mod)
print(p%mod)
#print(((((2**m)-1)%mod)**n)%mod)

n,m = map(int, input().split())
mo = 10**9 + 7
res = pow(2, m, mo)
res %= mo
res -= 1
res = pow(res, n, mo)
res %= mo
print(res)

n, m = map(int, input().split())
p = 10**9 + 7
print(pow((pow(2, m, p) - 1), n, p))

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

mod = 10**9+7

res1 = (pow(2,m,mod)-1)
res = pow(res1,n,mod)

print(res%mod)

n,m = map(int,input().split())
print(pow(2**m-1, n, 10**9+7))

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

def powerMod(base, exp):
    if exp == 0: return 1
    if exp == 1: return base
    ret = powerMod(base, exp//2)
    if exp % 2:
        ret = (ret * ret * base) % 1000000007
    else:
        ret = (ret * ret) % 1000000007

    return ret

base = powerMod(2, m) - 1

ans = powerMod(base, n)
print(ans)

import sys
input = sys.stdin.readline

'''

'''

def powmod(base, exp, mod):
    if exp <= 1:
        return base**exp
    elif exp % 2:
        return (base * powmod(base, exp-1, mod)) % mod
    else:
        return (powmod(base, exp//2, mod))**2 % mod

MOD = 10**9+7

n, m = map(int, input().split())
t = pow(2, m, MOD)-1 % MOD
print(powmod(t, n, MOD))

def power(x,y,p):     #Calculates (x**y)%p in O(log y)
    res = 1
    x = x%p

    while y>0:
        if ((y & 1)==1):
            res = (res*x)%p

        y = y>>1
        x = (x*x)%p

    return res

n,m = map(int, input().split())
print(power((2**m)-1,n,10**9+7))

import math
n , m = map(int , input().split())
MOD = int(1e9 + 7)
ans = 1;
my = pow(2,m,MOD)-1;
print(pow(my,n,MOD))

s=input().split()
n=int(s[0])
m=int(s[1])
mod=10**9+7
print(pow((pow(2,m,mod)-1),n,mod))

n, m = list(map(int, input().split()))

mod = int(1e9) + 7

ans = 1

a1 = ((pow(2, m, mod) - 1) + mod) % mod
ans = pow(a1, n, mod)

print(ans)

a,b=map(int,input().split())
m=7+10**9
ans=(pow(2,b,m)-1)%m
ans= (pow(ans,a,m))%m
print(ans)

n,m=map(int,input().split())
mod=1000000007
ans=(pow(2,m,mod)-1+mod)%mod
ans=pow(ans,n,mod)
print(ans)

n,m=list(map(int,input().split()))
M=pow(10,9)+7
a=pow(2,m,M)-1
a=a%M
b=pow(a,n,M)
print(b)

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

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

    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
import math
#q=int(input())
q=1
for _ in range(q):
    mod=10**9+7
    n,m=map(int,input().split())
    c=(power(2, m, mod)-1)%mod
    ans=power(c,n,mod)%mod
    print(ans%mod)

n,m=map(int,input().split())
def fun(x,y,m):
    res=1
    while y>0:
        if y%2==1:
            res=(res*x)%m
        y//=2
        x=(x*x)%m
    return res
tot = fun(2,m,10**9+7)-1
print(fun(tot,n,10**9+7))

from sys import stdin, stdout
import math,sys,heapq
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import random
import bisect as bi
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')):
    #------------------Sublime--------------------------------------#
    sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
    def I():return (int(input()))
    def In():return(map(int,input().split()))
else:
    #------------------PYPY FAst I/o--------------------------------#
    def I():return (int(stdin.readline()))
    def In():return(map(int,stdin.readline().split()))
#sys.setrecursionlimit(1500)
def dict(a):
    d={}
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d
def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bi.bisect_left(a, x)
    if i != len(a):
        return i
    else:
        return -1

def power(x, y, p):
    res = 1;
    x = x % p;
    while (y > 0):

        if (y & 1):
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;

    return res;
def main():
    try:
        n,m=In()
        temp=power((power(2,m,P)-1),n,P)
        print(temp)

    except:
        pass

M = 998244353
P = 1000000007

if __name__ == '__main__':
    #for _ in range(I()):main()
    for _ in range(1):main()

n,m = map(int,input().strip().split())
box1 = pow(2,m,10**9 + 7) - 1# summation of N Ci - 1
nbox = pow(box1,n,10**9 + 7)  # for n boxes
print(str(nbox))

from sys import *
mod=10**9+7
n,k=map(int,input().split())
print(pow(2**k-1,n,mod))

N, M = map(int, input().split())
mod = 10 ** 9 + 7

ans = pow(2, M, mod) - 1
ans = pow(ans, N, mod)
print(ans % mod)

#------------------------template--------------------------#
import os
import sys
# from math import *
from collections import *
# from fractions import *
from heapq import*
from bisect import *
from io import BytesIO, IOBase
def vsInput():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
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")
ALPHA='abcdefghijklmnopqrstuvwxyz'
M=10**9+7
EPS=1e-6
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]

#-------------------------code---------------------------#
# vsInput()

n,m=value()

ans=pow(2,m,M)-1
print(pow(ans,n,M))

try:
    arr = [int(x) for x in input().split()]
    mod = 1000000007
    var = pow(2,arr[1],mod) - 1
    ans = pow(var,arr[0],mod)
    print(ans)

except ValueError:
    pass

import math
list1=[int(x) for x in input().split(' ')]
n=list1[0]
m=list1[1]
print(pow((pow(2,m,10**9+7)-1),n,10**9+7))

import sys

def msub(a,b,mod):
	return ((a%mod)-(b%mod)+mod)%mod

[n,m]=[int(i) for i in sys.stdin.readline().split()]

mod=pow(10,9)+7

print(pow(msub(pow(2,m,mod),1,mod),n,mod))

import os
import sys
from io import BytesIO, IOBase

from types import GeneratorType
BUFSIZE = 8192
class FastIO(IOBase):
    newlines = 0

    def __init__(self, file):
        import os
        self.os = os
        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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
            self.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")

import time
start_time = time.time()

import collections as col
import math
from functools import reduce

def getInts():
    return [int(s) for s in input().split()]

def getInt():
    return int(input())

def getStrs():
    return [s for s in input().split()]

def getStr():
    return input()

def listStr():
    return list(input())

MOD = 10**9+7

"""

"""

def solve():
    N, M = getInts()
    return pow(pow(2,M,MOD)-1,N,MOD)

#for _ in range(getInt()):
print(solve())

n, m = map(int, input().split())
mod = 1000000007
x = int(pow(2, m))-1
y = pow(x, n, mod)
print(y)

import sys

def mmul(a,b,mod):
	return ((a%mod)*(b%mod))%mod

def msub(a,b,mod):
	return (a%mod-b%mod+mod)%mod

[n,m]=[int(i) for i in sys.stdin.readline().split()]

mod=pow(10,9)+7

s_tmp=msub(pow(2,(n-1)*m,mod),1,mod)

sub_val=mmul(n,s_tmp,mod)

tmp=msub(pow(2,n*m,mod),1,mod)

print(msub(tmp,sub_val,mod))

mod= 10**9 +7

def power(a,b):
    ans=1
    while(b>0):
        if(b%2!=0):
            ans=ans*a%mod
        b=b>>2
        a=a*a
        ans=ans*a%mod
    return ans

(n,m)=[int(x) for x in input().split()]
res=power(2,m)-1
res=power(res,n)
print(res%mod)

n, m = list(map(int, input().split()))

mod = int(10e9) + 7

ans = 1

a1 = ((pow(2, m, mod) - 1) + mod) % mod
ans = pow(a1, n, mod)

print(ans)

n,m = map(int,input().split())
print(pow(2**m-1, n, 10**+7))

import sys

def mmul(a,b,mod):
	return ((a%mod)*(b%mod))%mod

def msub(a,b,mod):
	return (a%mod-b%mod+mod)%mod

[n,m]=[int(i) for i in sys.stdin.readline().split()]

mod=pow(10,9)+7

# mul1=mmul(pow(2,n-1,mod),pow(2,m,mod),mod)
mul1=pow(pow(2,n-1,mod),m,mod)

s_tmp=msub(mul1,1,mod)

sub_val=mmul(n,s_tmp,mod)

# mul2=mmul(pow(2,n,mod),pow(2,m,mod),mod)
mul2=pow(pow(2,n,mod),m,mod)

tmp=msub(mul2,1,mod)

print(msub(tmp,sub_val,mod))

inp = [int(x) for x in input().split()]
ans = pow(inp[1]**2-1, inp[0], 10**9+7)
print(ans)

n, m = map(int, input().split())
max = 10**9+7
x = pow(2,m,max)-1
if x == 1:
    ans = pow(2,n,max) - 1
    print(ans%max)
else:
    ans = pow(x,n,max)
    print(ans%max)

M = 1e9 +7

def pw(x,y):
  s=1
  x%=M
  while y:
    if y & 1: s=(s*x)%M
    x=(x*x)%M
    y>>=1
  return s

n, m = map(int, input().split())
print(int(pw(pw(2,m)-1, n)))

n,m = map(int, input().split())
mo = 10*9 + 7
res = pow(2, m, mo) -1
res = pow(res, n, mo)
res %= mo
print(res)

#------------------------template--------------------------#
import os
import sys
# from math import *
from collections import *
# from fractions import *
from heapq import*
from bisect import *
from io import BytesIO, IOBase
def vsInput():
    sys.stdin = open('input.txt', 'r')
    sys.stdout = open('output.txt', 'w')
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")
ALPHA='abcdefghijklmnopqrstuvwxyz'
M=10**9
EPS=1e-6
def value():return tuple(map(int,input().split()))
def array():return [int(i) for i in input().split()]
def Int():return int(input())
def Str():return input()
def arrayS():return [i for i in input().split()]

#-------------------------code---------------------------#
# vsInput()

n,m=value()

ans=pow(2,m,M)-1
print(pow(ans,n,M))

import sys,math,fractions,bisect
def fi():
    return int(sys.stdin.readline())

def fi2():
    return map(int, sys.stdin.readline().split())

def fi3():
    return sys.stdin.readline()

def fo(*args):
    for s in args:
        sys.stdout.write(str(s)+' ')
    sys.stdout.write('\n')
INF=10**9+7
sys.setrecursionlimit(INF)

#main
n,m=fi2()
x=math.pow(2,m)
res=math.pow(x-1,n)
fo(res)

def bin_pow(base, p):
    MOD = 1000000007
    base = int(base)
    p = int(p)
    if(p == 1):
        return base

    if(p % 2 == 0):
        t = int(bin_pow(base, p // 2))
        return t * t % MOD

    else:
        return bin_pow(base, p - 1) * base % MOD

values = input().split()
n = int(values[0])
m = int(values[1])
if(n == 1):
    print(bin_pow(2, n*m) - bin_pow(2, n) + 1)
else:
    print(bin_pow(2, n*m) - bin_pow(2, n + 1) + 1)

mod=1000000007
def power(x,y):
	res=1
	while y>0:
		if y%2==1:
			res=(res*x)%mod
		y=y//2
		x=(x*x)%mod
	return res
n,m=map(int,input().split())
if n==1:
	print((power(2,m)%mod)-1)
	exit()
xx=((n*(n+1))%mod)
yy=(xx*power(2,mod-2))%mod
ans=power(yy,m)%mod
print(ans)

N,M = map(int,input().split())
mod = 10**9 + 7
'''
N : the number of kind of presents
M : The number of boxes
answer = (2 ** M - 1) ** N
But, N and M have range 10~9 ..
'''
def solve(a,x):
    num = str(format(x,'b'))
    ret = 1
    for i in range(-1,len(num)):
        if num[i] == '1':
            ret = ret * a % mod
        a = a * a % mod
    return ret
a = solve(2,M) - 1
ans = solve(a,N)
print(ans)

n,m = map(int, input().split(" "))
res = 1

def power(x, y, p) :
    res = 1
    x = x % p
    while (y > 0) :
        if ((y & 1) == 1) :
            res = (res * x) % p
        y = y >> 1
        x = (x * x) % p
    return res

res = power(2,m,1000000007)
if res == 0:
    res = 1000000007 - 1
else:
    res = res - 1
res1 = power(res,n,100000007)
print(res1)

def quickpow(a,b):
    mod=1e9+7
    ret=1
    while(b):
        if(b&1):
            ret=ret*a%mod
        a=a*a%mod
        b>>=1
    return ret
s=input().split()
n=int(s[0])
m=int(s[1])
ans=quickpow(2,m)
ans-=1
ans=quickpow(ans,n)
ans=int(ans)
print(ans)

def power(x, y) :
    res = 1

    p = 10**9 + 7

    x = x % p

    while (y > 0) :

        if ((y & 1) == 1) :
            res = (res * x) % p

        y = y >> 1
        x = (x * x) % p

    return res

n,m = list(map(int,input().split()))
mod = 10**9 + 7
ans = 0
ans = (ans + power(2,m*n+1))%mod
ans = (ans - power(power(2,m)+1,n))%mod
ans = (ans + power(2,n) - 2)%mod

print(ans)

n, m = map(int, input().split())
p = 10**9 + 7
print(pow(pow(2, m, p) + m - 1, n, p))

def I(): return(list(map(int,input().split())))
n,m=I()
x=pow(2,m)
print(pow(x-1,m,1000000007))

N, M = map(int, input().split())
mod = 10 ** 9 + 7

ans = pow(pow(2, M, mod), N, mod)
ans %= mod
ans -= N * pow(pow(2, M, mod), N - 1, mod)
ans %= mod
ans += (N - 1)
ans %= mod
print(ans)

from sys import stdin,stdout
I = lambda : map(int,stdin.readline().split())

def nCr(n, r, p):
    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

n,m = I()
mod = 10**9 + 7
ans1 = pow(2,n,mod) - 1
ans2 = pow(2,m,mod) - 1
print (ans1*ans2)%mod

a,b=map(int,input().split())
mod = 10**9+7
print((pow(2,a,mod)*b+1)%mod)

N, M = map(int, input().split())
mod = 10 ** 9 + 7

ans = pow(pow(2, M, mod), N, mod)
ans %= mod
ans -= N * pow(pow(2, M, mod), N - 1, mod)
if ans < 0:
    ans += mod
ans %= mod
ans += (N - 1)
ans %= mod
print(ans)

mod = 10 ** 9 + 7

def binpow(a, n):
    pw = a
    res = 1
    while n > 0:
        if n % 2 == 1:
            res *= pw
            res %= mod
        n //= 2
        pw *= a
        pw %= mod
    return res

n, m = map(int, input().split())
b = binpow(2, m) - 1
print(binpow(b, n))

import sys
inputfn = sys.stdin.readline

def fastExp(A, E, N):
	if (E == 0):
		return 1
	if (E == 1):
		return A % N
	rec = fastExp(A, E // 2, N)
	rec = (rec * rec) % N
	if (E % 2 == 0):
		return rec
	return ((A % N) * rec) % N

nm = inputfn().split(" ")
n = int(nm[0])
m = int(nm[1])

modulus = 10**9 + 7
gifts = fastExp(2, n, modulus) - 1
boxes = fastExp(2, m, modulus) - 1
print((gifts * boxes) % modulus)

n, m = map(int, input().split())
max = 10**9+7
x = pow(2,n,max)-1
if x == 1:
    ans = pow(2,m,max) - 1
    print(ans%max)
else:
    ans = pow(x,m,max)
    print(ans%max)

modulo = (pow(10, 9) + 7)
n, m = [int(x) for x in input().split()]
print((pow(2, n*m, modulo) - n * pow(2, (n-1)*m, modulo) + (n - 1)) % modulo)

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

mod = 10**9+7

res = pow(2,n*m,mod) - (n*pow(2,(n-1)*m,mod))%mod + (n-1)%mod

print(res%mod)

mod=1000000007
def power(x,y):
	res=1
	while y>0:
		if y%2==1:
			res=(res*x)%mod
		y=y//2
		x=(x*x)%mod
	return res
n,m=map(int,input().split())
if n==1:
	print(power(n+1,m)-1)
else:
	print(power(n+1,m))

from sys import stdin

mod = 1000000007

def pow1(x, base):
    sq = 1
    while (base > 0):

        if base % 2:
            base -= 1
            sq = (sq * x) % mod

        base //= 2
        x = (x * x) % mod

    return sq

n, m = map(int, stdin.readline().split())
print(pow1(pow1(2, n), m) - (pow1(2, pow1(2, n) - 1) - 1))

n, m = list(map(int, input().split()))

mod = int(10e9) + 7

ans = 1

a1 = ((pow(2, m, mod) - 1) + mod) % mod
ans = pow(a1, n, mod)

print(ans)

n, m = map(int, input().split())
max = 10**9+7
x = pow(2,m,max)-1
if x == 1:
    ans = pow(2,n,max) - 1
    print(ans%max)
else:
    ans = pow(x,n,max)
    print(ans%max)

n,m=map(int,input().split())
mod=1000000007
x=(1<<n)
ans=((m%mod)*(x%mod))%mod
ans=((ans%mod) + (1%mod))%mod
print(ans)

presents, boxes = map(int, input().split())
print( pow(pow(2, boxes, 10**9+1) - 1, presents, 10**9+1) )

mod= 10**9 +7

def power(a,b):
    ans=1
    while(b>0):
        if(b%2!=0):
            ans=ans*a%mod
        b=b>>1
        a=a*a%mod
        ans=ans*a%mod
    return ans

(n,m)=[int(x) for x in input().split()]
res=power(2,m)-1
res=power(res,n)
print(res%mod)

n,m=map(int,input().split())
mod=1000000007
x=(1<<n)
ans=((m%mod)*(x%mod))%mod
ans+=1
print(ans%mod)

s=input().split()
n=int(s[0])
m=int(s[1])
x=pow(2,m)
y=pow(x-1,n,10007)
print(y)

n,m = map(int, input().split())
mo = 10*9 + 7
res = pow(2, m, mo)
res %= mo
res -= 1
res = pow(res, n, mo)
res %= mo
print(res)

n, m = map(int, input().split())
print((n*m)*2 + 1)

if __name__=="__main__":
    n,m=[int(x) for x in input().split()]

    mod=(10**9)+7

    np=pow(2,n,mod)-1
    mp=pow(2,m,mod)-1
    ans=((np%mod)*(mp%mod))%mod
    print(ans)

A, B = map(int, input().split())
MOD = int(1e9)+7
rtot = pow(pow(2, A, MOD), B, MOD) - 1
rpart = pow(pow(2, A-1, MOD), B, MOD) - 1
rpart *= A
rpart %= MOD
rtot %= MOD
print (rtot-rpart%MOD)

n,m = map(int,input().split())
print(pow(2**m-1, n, 10**+7))

MOD = 10 ** 9 + 7
def power(a, n):
  if n == 0:
    return 1
  if n % 2 == 0:
    return power(a, n // 2) ** 2 % MOD
  return power(a, n - 1) * a

n, m = map(int, input().split())
print(power(power(2, m) + MOD - 1, n))

#!/usr/bin/env pypy
from __future__ import division, print_function
from collections import defaultdict, Counter, deque
from future_builtins import ascii, filter, hex, map, oct, zip
from random import randint
from itertools import imap as map, izip as zip, permutations, combinations, combinations_with_replacement
from __builtin__ import xrange as range
from math import ceil
from _continuation import continulet
from cStringIO import StringIO
from io import IOBase
import __pypy__
from bisect import bisect, insort, bisect_left, bisect_right
import sys
import os
import re
sys.setrecursionlimit(9999)
inf = float('inf')
mod = int(1e9) + 7
mod_ = 998244353
N = 5001

'''
Check for special cases (n=1)
One wrong submission = 10 mins penalty!
do smth instead of nothing and stay organized
'''

def main():
	n, m = map(int, input().split())
	a = pow(2, n*m, mod)
	b = pow(2, (n-1)*m, mod)
	b = (b * n) % mod
	b = (b - (n-1) + mod) % mod
	total = max(0, a - b) % mod
	print(total)

BUFSIZE = 8192
class FastI(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = StringIO()
		self.newlines = 0

	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("\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()
class FastO(IOBase):
	def __init__(self, file):
		self._fd = file.fileno()
		self._buffer = __pypy__.builders.StringBuilder()
		self.write = lambda s: self._buffer.append(s)

	def flush(self):
		os.write(self._fd, self._buffer.build())
		self._buffer = __pypy__.builders.StringBuilder()
def print(*args, **kwargs):
	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()
def gcd(x, y):
	while y:
		x, y = y, x % y
	return x
sys.stdin, sys.stdout = FastI(sys.stdin), FastO(sys.stdout)
def input(): return sys.stdin.readline().rstrip("\r\n")
if __name__ == "__main__":
	def bootstrap(cont):
		call, arg = cont.switch()
		while True:
			call, arg = cont.switch(to=continulet(
				lambda _, f, args: f(*args), call, arg))
	cont = continulet(bootstrap)
	cont.switch()
	main()

def I(): return(list(map(int,input().split())))
n,m=I()
x=pow(2,m)
print(pow(x-1,m,1000000007))

mod = pow(10, 9) + 7
n, box = map(int,input().split())
print(pow((pow(2, box) - 1),n) // mod)

from collections import defaultdict, deque
from itertools import permutations
from sys import stdin,stdout
from bisect import bisect_left, bisect_right
from copy import deepcopy

#from random import randint

int_input=lambda : int(stdin.readline())
string_input=lambda : stdin.readline()
multi_int_input =lambda : map(int, stdin.readline().split())
multi_input = lambda : stdin.readline().split()
list_input=lambda : list(map(int,stdin.readline().split()))
string_list_input=lambda: list(string_input())
MOD = pow(10,9)+7

n,m = multi_int_input()

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

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

    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

print(pow((2**n-1),m,MOD))

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

def powerMod(base, exp):
    if exp == 0: return 1
    if exp == 1: return base
    ret = powerMod(base, exp//2)
    if exp % 2:
        ret = (ret * ret * base) % 10000000007
    else:
        ret = (ret * ret) % 10000000007

    return ret
base = powerMod(2, m) - 1

ans = powerMod(base, n)
print(ans)

MOD = 10 ** 9 + 7
def pw(a, b):
    global mod
    if b == 1:
        return a
    elif b == 0:
        return 1
    if b % 2 == 0:
        return pw(a * a % MOD, b // 2)
    else:
        return pw(a * a % MOD , b // 2) * a

a, b = [int(x) for x in input().split()]
if (a == 1):
    pow1 = 2
else:
    pow1 = (a * a) % MOD
if (a == 2):
    pow2 = 2
else:
    pow2 = ((a - 1) * (a - 1)) % MOD
ans1 = (pw(pow1, b)) % MOD
ans2 = (max(pw(pow2, b) - 1, 0) * b) % MOD
print(((ans1 - ans2) % MOD) - 1)

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

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

    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
import math
#q=int(input())
q=1
for _ in range(q):
    mod=10**7+9
    n,m=map(int,input().split())
    ans=(power(2, m, mod)-1)%mod
    ans=power(ans,n,mod)%mod
    print(ans%mod)

from sys import stdin, stdout
import math,sys,heapq
from itertools import permutations, combinations
from collections import defaultdict,deque,OrderedDict
from os import path
import random
import bisect as bi
def yes():print('YES')
def no():print('NO')
if (path.exists('input.txt')):
    #------------------Sublime--------------------------------------#
    sys.stdin=open('input.txt','r');sys.stdout=open('output.txt','w');
    def I():return (int(input()))
    def In():return(map(int,input().split()))
else:
    #------------------PYPY FAst I/o--------------------------------#
    def I():return (int(stdin.readline()))
    def In():return(map(int,stdin.readline().split()))
#sys.setrecursionlimit(1500)
def dict(a):
    d={}
    for x in a:
        if d.get(x,-1)!=-1:
            d[x]+=1
        else:
            d[x]=1
    return d
def find_gt(a, x):
    'Find leftmost value greater than x'
    i = bi.bisect_left(a, x)
    if i != len(a):
        return i
    else:
        return -1

def power(x, y, p):
    res = 1;
    x = x % p;
    while (y > 0):

        if (y & 1):
            res = (res * x) % p;
        y = y >> 1;
        x = (x * x) % p;

    return res;
def main():
    try:
        n,m=In()
        print(((power(2,m,P))-1)%P*((power(2,n,P)%P)-1)%P)

    except:
        pass

M = 998244353
P = 1000000007

if __name__ == '__main__':
    #for _ in range(I()):main()
    for _ in range(1):main()

n,m = list(map(int,input().split()))
mod = 10**9+7
boxes = pow(2,m,mod)-1
gift = pow(2,n,mod)-1
print((boxes*gift)%mod)

n, m = map(int, input().split())
mod = 10 ** 9 + 7
ans = (pow(2, m, mod) - 1 + mod) * n % mod
print(ans)

n, m = [int(i) for i in input().split()]

N = 1000000007;

def exponentiation(bas, exp):
    if (exp == 0):
        return 1;
    if (exp == 1):
        return bas % N;

    t = exponentiation(bas, int(exp / 2));
    t = (t * t) % N;

    if (exp % 2 == 0):
        return t;

    else:
        return ((bas % N) * t) % N;

modulo = exponentiation(2, m)
print(exponentiation(modulo, n))

s=input().split()
n=int(s[0])
m=int(s[1])
x=pow(2,m)
y=pow(x-1,n,10007)
print(y)

from itertools import combinations
inp=[int(x) for x in input().split()]
n,m=inp[0], inp[1]
ways=0
ok=range(1,n+1)
print(len(list(combinations(ok,m))))

M = 1e9 +7

def pw(x,y):
  s=1
  x%=M
  while y:
    if y & 1: s=(s*x)%M
    x=(x*x)%M
    y>>=1
  return s

n, m = map(int, input().split())
print(int(pw(pw(2,m)-1+M, n)))

import math
inp=[int(x) for x in input().split()]
n,m=inp[0], inp[1]
print(math.factorial(m)*n +1)

def mypow(m,n):
    s=1
    while n:
        if n&1:
            s=((s*m)%M)
        m=(m*m)%M
        n=n>>1
    return(s%M)
m,n=list(map(int,input().split()))
M=1000000007
ans=mypow(m,n)
ans-=1
ans=mypow(ans,m)
print(ans)

n,m = map(int, input().split())
mo = 10*9 + 7
res = pow(2, m, mo)
res %= mo
res -= 1
res = pow(res, n, mo)
res %= mo
print(res)

n,m=map(int,input().split())
def fun(x,y,m):
    res=1
    while y>0:
        if y%2==1:
            res=(res*x)%m
        y//=2
        x=(x*x)%m
    return res
tot = fun(2,m,10**9-7)-1
print(fun(tot,n,10**9+7))

n,m=list(map(int,input().split()))
M=pow(10,9)+7
a=pow(2,m,M)-1
a=a%m
b=pow(a,n,M)
print(b)

n, m = map(int, input().split())
print((n*m)*max(n, (m-1)) + 1)


import sys
from math import gcd
# sys.setrecursionlimit(10000)

class BinaryField:
    def __init__(self, s):
        """Given a binary string, return a BinaryField element.
        Input:
        s: Has to take one of the following form:
           1. A binary string, with MSB as the highest degree polynomial
           2. An integer, with MSB as the highest degree polynomial"""
        if type(s) == int:
            self.poly = s

        else:
            self.poly = 0

            for c in s:
                self.poly = (self.poly << 1) + int(c)

        if self.poly == 0:
            self.deg = float('-inf')
        else:
            self.deg = len(bin(self.poly)) - 3

    def __repr__(self):
        return f'BinaryField(poly={bin(self.poly)[2:]}, deg={self.deg})'

    def __eq__(self, other):
        return self.poly == other.poly

    def __add__(self, other):
        return BinaryField(self.poly ^ other.poly)

    def __mul__(self, other):
        temp = other.poly
        answer = 0
        align = self.poly

        while temp:
            if temp & 1:
                answer ^= align

            align <<= 1
            temp >>= 1

        return BinaryField(answer)

    def __truediv__(self, other):
        if other.poly == 0:
            raise ZeroDivisionError

        answer = 0
        temp = self.poly

        for d in range(max(self.deg - other.deg, 0), -1, -1):
            if temp & (1 << (other.deg + d)):
                answer += (1 << d)
                temp ^= (other.poly << d)

        return BinaryField(answer)

    def __mod__(self, other):
        if other.poly == 0:
            raise ZeroDivisionError

        answer = 0
        temp = self.poly

        for d in range(max(self.deg - other.deg, 0), -1, -1):
            if temp & (1 << (other.deg + d)):
                answer += (1 << d)
                temp ^= (other.poly << d)

        return BinaryField(temp)

    def square(self):
        """Returns the square of the polynomial itself.
        Faster than a * a"""
        answer = 0
        temp = self.poly

        while temp:
            lsb = temp & (-temp)
            answer += lsb ** 2

            temp -= lsb

        return BinaryField(answer)

    def powmod(self, exp, mod):
        """Return (self**exp) % mod
        Inputs:
        exp: An integer power
        mod: A BinaryField element representing the modulus"""
        answer, temp = BinaryField(1), self

        while exp:
            if exp & 1:
                answer = (answer * temp) % mod

            exp >>= 1
            temp = temp.square() % mod

        return answer

    @staticmethod
    def gcd(poly1, poly2):
        """Given two BinaryField elements, return its gcd
        Input:
        poly1, poly2: two BinaryField elements.
        Output:
        The gcd of poly1 and poly2 as a BinaryField instance."""
        if poly1.deg < poly2.deg:
            poly1, poly2 = poly2, poly1

        p1, p2 = poly1, poly2
        while p2.poly != 0:
            p1, p2 = p2, p1 % p2

        return p1

    @staticmethod
    def factorize(poly):
        """Factorize a BinaryField object
        Input:
        poly: A BinaryField element
        Return: A list of tuples (poly, exp)."""
        answer = []
        temp = poly

        for d in range(2, 2**(1+poly.deg//2)):
            div = BinaryField(d)

            e = 0
            while temp % div == BinaryField(0):
                temp = temp / div
                e += 1

            if e:
                answer.append((div, e))

            if temp == BinaryField(1): break

        if temp != BinaryField(1):
            answer.append((temp, 1))

        return answer

def input_general():
    return sys.stdin.readline().rstrip('\r\n')

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

def input_multi(x=int):
    return map(x, sys.stdin.readline().rstrip("\r\n").split())

def input_list(x=int):
    return list(input_multi(x))

def main(s):
    def get_factor(n):
        factors = {1}

        for p in range(2, 1 + int(n**0.5)):
            e = 0

            while n % p == 0:
                n //= p
                e += 1

            if e:
                factors = {f * (p**i) for f in factors for i in range(e+1)}

            if n == 1: break

        if n != 1:
            factors = {f * g for f in factors for g in (1, n)}

        return factors

    s = s.rstrip('0')
    leading_0 = s.find('1')

    answer = 1

    if leading_0 == -1:
        print('-1')
        return

    f2s = BinaryField(s)
    x = BinaryField(2)
    factors_bin = BinaryField.factorize(f2s)

    for f, exp in factors_bin:
        factors_pow = sorted(list(get_factor(2**f.deg-1)))

        for e in factors_pow:
            if x.powmod(e, f) == BinaryField(1):
                if exp == 1:
                    need = e
                else:
                    need = e * (2**(len(bin(exp-1)) - 2))

                g = gcd(answer, need)
                answer = answer * need // g

                break

    print(1 + leading_0, 1 + leading_0 + answer)

if __name__ == "__main__":
    s = input_general()

    main(s)

import sys
from math import lcm
from collections import defaultdict

def solve(p):
	poly = int(p[::-1], 2)
	assert p[0] == '1' and p[-1] == '1'
	degree = len(p) - 1
	def reduce(a):
		while a.bit_length() > degree:
			b = a.bit_length() - degree - 1
			a ^= poly << b
		assert a < (1 << degree)
		return a

	def mul(a, b):
		a = reduce(a)
		b = reduce(b)
		val = 0
		for i in range(degree):
			if (a >> i) & 1:
				val ^= (b << i)
		for i in range(degree, -1, -1):
			if (val >> (degree + i)) & 1:
				val ^= poly << i
		return val

	def pow(a, k):
		res = 1
		while k:
			if k & 1:
				res = mul(res, a)
			k >>= 1
			a = mul(a, a)
		return res

	pfs = defaultdict(int)
	pfs[2] += degree
	for i in range(1, degree + 1):
		cur = 2 ** i - 1
		p = 2
		while p * p <= cur:
			while cur % p == 0:
				cur //= p
				pfs[p] += 1
			p += 1
		if cur > 1:
			pfs[cur] += 1
	order_multiple = 1
	for p in pfs:
		order_multiple *= p ** pfs[p]

	order = order_multiple
	x = reduce(1 << 1)
	for p in pfs:
		while order % p == 0 and pow(x, order // p) == 1:
			order //= p
	return order

s = input()
if '1' not in s:
	print(-1)
	sys.exit()

p = s.lstrip('0')
l0 = len(s) - len(p)
p = p.rstrip('0')

res = solve(p)
print(f"{1 + l0} {1 + l0 + res}")