It is the easy version of the problem. The difference is that in this version, there are no nodes with already chosen colors.

Theofanis is starving, and he wants to eat his favorite food, sheftalia. However, he should first finish his homework. Can you help him with this problem?

You have a perfect binary tree of $2^k - 1$ nodes — a binary tree where all vertices $i$ from $1$ to $2^{k - 1} - 1$ have exactly two children: vertices $2i$ and $2i + 1$. Vertices from $2^{k - 1}$ to $2^k - 1$ don't have any children. You want to color its vertices with the $6$ Rubik's cube colors (White, Green, Red, Blue, Orange and Yellow).

Let's call a coloring good when all edges connect nodes with colors that are neighboring sides in the Rubik's cube.

A picture of Rubik's cube and its 2D map.

More formally:

a white node can not be neighboring with white and yellow nodes;

a yellow node can not be neighboring with white and yellow nodes;

a green node can not be neighboring with green and blue nodes;

a blue node can not be neighboring with green and blue nodes;

a red node can not be neighboring with red and orange nodes;

an orange node can not be neighboring with red and orange nodes;

You want to calculate the number of the good colorings of the binary tree. Two colorings are considered different if at least one node is colored with a different color.

The answer may be too large, so output the answer modulo $10^9+7$.


-----Input-----

The first and only line contains the integers $k$ ($1 \le k \le 60$) — the number of levels in the perfect binary tree you need to color.


-----Output-----

Print one integer — the number of the different colorings modulo $10^9+7$.


-----Examples-----

Input
3
Output
24576
Input
14
Output
934234


-----Note-----

In the picture below, you can see one of the correct colorings of the first example.

Difficulty: EASY
Tags: Combinatorics

Mathematics

Starter code:

Solutions:
n = int(input())
mod = 1000000007
c1 = 6
c2 = 16
for i in range(1, n):
	c1 = c1 * c2 % mod
	c2 = c2 * c2 % mod
print(c1)


c = int(input())
m = pow(2, c) - 2
b = pow(4, m, 1000000007)
b = b * 6 % 1000000007
print(b)


def binpow(a, n):
	res = 1
	while n:
		if n & 1:
			res *= a % int(1000000000.0 + 7)
		a *= a % int(1000000000.0 + 7)
		n >>= 1
	return res % int(1000000000.0 + 7)
n = int(input())
ans = 6
res = binpow(4, 2 ** n - 2)
print(ans * res % int(1000000000.0 + 7))


import sys

def readnum():
	input = sys.stdin.readline
	a = list(map(int, input().split()))
	return a

def printf(val):
	sys.stdout.write(str(val) + '\n')
n = readnum()[0]

def power(a, b, mod):
	if b == 1:
		return a
	if b == 0:
		return 1
	ans = power(a, b // 2, mod)
	ans *= ans
	if b % 2:
		ans *= a
	ans = ans % mod
	return ans
print(6 * power(4, 2 ** n - 2, 10 ** 9 + 7) % (10 ** 9 + 7))


mod = 10 ** 9 + 7
n = int(input())
x = pow(2, n) - 2
print(6 * pow(4, x, mod) % mod)


n = int(input())
mod = 1000000007
print(6 * pow(4, 2 ** n - 2, mod) % mod)


mod = 10 ** 9 + 7
k = int(input())
c = pow(2, k) - 2
ans = pow(4, c, mod) * 6 % mod
print(ans)


n = int(input())
ans = 6
MOD = 1000000007

def fast_exp2(n, i):
	if i == 1:
		return n
	temp = fast_exp2(n, i // 2)
	if i % 2 == 0:
		return temp * temp
	else:
		return temp * temp * n

def fast_exp(n, i):
	if i == 1:
		return n
	temp = fast_exp(n, i // 2)
	temp %= MOD
	if i % 2 == 0:
		return temp * temp % MOD
	else:
		a = temp * temp % MOD
		return n % MOD * (a % MOD) % MOD
for i in range(1, n):
	ans *= fast_exp(4, fast_exp2(2, i))
	ans %= MOD
print(ans)


modulo = pow(10, 9) + 7

def power(base, exp):
	if exp < 0:
		return 1 / power(base, -exp)
	ans = 1
	while exp:
		if exp & 1:
			ans *= base
		exp >>= 1
		base *= base
		base %= modulo
		ans %= modulo
	return ans % modulo
k = int(input())
result = 6 * power(4, pow(2, k) - 2) % modulo
print(result)


n = int(input())
ans = 1
for i in range(0, n - 1):
	ans = ans * ans * 16 % int(1000000000.0 + 7)
ans = ans * 6 % int(1000000000.0 + 7)
print(ans)


from sys import stdin
inp = stdin.readline
t = int(inp())
s = 4
for _ in range(t - 2):
	s = s ** 2 * 4 % (10 ** 9 + 7)
if t > 1:
	s = s ** 2 * 6 % (10 ** 9 + 7)
else:
	s = 6
print(s)


n = int(input())
sum = 6
powe = 1
mo = 1000000007
s = 4
for i in range(2, n + 1):
	powe = powe * 2
	s = s * s
	s = s % mo
	sum = sum % mo
	sum = sum * s
print(sum % mo)


n = int(input())
p = (1 << n) - 2
mod = 10 ** 9 + 7
ans = pow(4, p, mod)
ans *= 6
print(ans % mod)


mod = 10 ** 9 + 7
print(6 * pow(4, pow(2, int(input())) - 2, mod) % mod)


p = 1000000007

def power(x, y):
	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 = int(input())
nodes = (1 << n) - 1
nodes -= 1
ans = 6 * power(4, nodes) % p
print(ans)


k = int(input())
l = [1]
m = 10 ** 9 + 7
for i in range(k - 1):
	l.append(16 * l[-1] ** 2 % m)
print(6 * l[-1] % m)


n = int(input())
k = int(pow(2, n))
MOD = int(1000000007)
print(6 * pow(4, k - 2, MOD) % MOD % MOD)


k = int(input())
x = int(pow(2, k) - 2)
print(6 * pow(4, x, 1000000007) % 1000000007)


n = int(input())
s = 0
for i in range(2, n + 1):
	s += 2 ** i
a = pow(2, s, 10 ** 9 + 7)
print(a * 6 % (10 ** 9 + 7))


from sys import stdin

def read_input():
	k = int(stdin.readline())
	return (k,)

def solve(k):
	return 6 * pow(4, 2 ** k - 2, 1000000007) % 1000000007

def main():
	input = read_input()
	answer = solve(*input)
	print(answer)
main()


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from collections import Counter
from collections import defaultdict as dd
flush = lambda : stdout.flush()
stdstr = lambda : stdin.readline()
stdint = lambda : int(stdin.readline())
stdpr = lambda x: stdout.write(str(x))
stdmap = lambda : map(int, stdstr().split())
stdarr = lambda : list(map(int, stdstr().split()))
mod = 1000000007
k = stdint()
res = 6
for i in range(2, k + 1):
	x = pow(4, pow(2, i - 1), mod)
	res = res * x % mod
print(res % mod)


n = int(input())
mod = 10 ** 9 + 7

def binpow(a, n, mod):
	if n == 0:
		return 1
	if n == 1:
		return a % mod
	if n % 2 == 0:
		return binpow(a, n // 2, mod) ** 2 % mod
	else:
		return binpow(a, n - 1, mod) * a % mod
k = binpow(4, (1 << n) - 2, mod) % mod
print(k * 6 % mod)


import sys
from bisect import bisect_right as lb
from collections import deque
from queue import PriorityQueue as pq
from math import gcd
input_ = lambda : sys.stdin.readline().strip('\r\n')
ii = lambda : int(input_())
il = lambda : list(map(int, input_().split()))
ilf = lambda : list(map(float, input_().split()))
lii = lambda : list(map(int, list(ip())))
ip = lambda : input_()
fi = lambda : float(input_())
ap = lambda ab, bc, cd: ab[bc].append(cd)
li = lambda : list(input_())
pr = lambda x: print(x)
prinT = lambda x: print(x)
f = lambda : sys.stdout.flush()
inv = lambda x: pow(x, mod - 2, mod)
mod = 10 ** 9 + 7
for _ in range(1):
	n = ii()
	node = 2 ** n - 1
	prinT(6 * pow(4, node - 1, mod) % mod)


k = int(input())
mod = 1000000007
print(6 * pow(4, pow(2, k) - 2, mod) % mod)


import collections
import os
import sys
from io import BytesIO, IOBase
from bisect import bisect_left
from math import gcd, log, ceil
from collections import Counter
from pprint import pprint
import heapq
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 two_power(n):
	dp = [1 for _ in range(n + 1)]
	mod = int(1000000000.0 + 7)
	for i in range(1, n + 1):
		dp[i] = dp[i - 1] * 2 % mod
	return dp

def main():
	n = int(input())
	if n == 1:
		print(6)
		return
	mod = int(1000000000.0 + 7)
	ans = 6
	a = 2 ** n - 2
	b = pow(4, a, mod) % mod
	print(b * ans % mod)
for _ in range(1):
	main()


n = int(input())
mod = 1000000000 + 7
res = 6
m = 16
i: int
for i in range(1, n):
	res *= m % mod
	res %= mod
	m *= m % mod
	m %= mod
print(int(res))


k = int(input())
s = 2 ** k - 2
ans = 6
bin = bin(s)[2:]
powers = 4
for i in range(len(bin)):
	if bin[len(bin) - 1 - i] == '1':
		ans = ans * powers % 1000000007
	powers = powers ** 2 % 1000000007
print(ans)


from sys import stdin as sin

def aint():
	return int(input())

def amap():
	return map(int, sin.readline().split())

def alist():
	return list(map(int, sin.readline().split()))

def astr():
	return input()

def rec(n, m):
	g = 4
	ans = 1
	while n > 0:
		if n % 2 == 1:
			ans = ans * g % m
		g = g * g % m
		n >>= 1
	return ans
mod = 10 ** 9 + 7
n = aint()
if n == 1:
	print(6)
else:
	ans = rec(2 ** n - 2, 10 ** 9 + 7)
	ans = ans * 6
	print(ans % (10 ** 9 + 7))


import io, os, sys
import math
import random
from queue import PriorityQueue as PQ
from bisect import bisect_left as BSL
from bisect import bisect_right as BSR
from collections import OrderedDict as OD
from collections import Counter
from itertools import permutations
from decimal import Decimal as BIGFLOAT
mod = 1000000007
sys.setrecursionlimit(10 ** 6)
try:
	f = os.open('actext.txt', os.O_RDONLY)
	input = io.BytesIO(os.read(f, os.fstat(f).st_size)).readline
except:
	input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def get_ints():
	return map(int, input().decode().split())

def palindrome(s):
	mid = len(s) // 2
	for i in range(mid):
		if s[i] != s[len(s) - i - 1]:
			return False
	return True

def check(i, n):
	if 0 <= i < n:
		return True
	else:
		return False

def binlifting(k):
	k = bin(k)[2:]
	ans = 4
	res = 1
	for i in k[::-1]:
		if i == '1':
			res *= ans
			res = res % mod
		ans = ans * ans
		ans = ans % mod
	return res % mod

def solve(n):
	nn = 2 ** n - 2
	ans = 6
	ans = ans * binlifting(nn)
	ans = ans % mod
	print(ans)
n = int(input().decode())
solve(n)


from math import sqrt, gcd, ceil, floor, log, factorial
from itertools import permutations, combinations
from collections import Counter, defaultdict
import collections, sys, threading
import collections, sys, threading
from bisect import *

def ii():
	return int(input())

def si():
	return input()

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

def msi():
	return map(str, input().split())

def li():
	return list(mi())
k = ii()
mod = 10 ** 9 + 7
pow1 = pow(2, k) - 2
ans = pow(4, pow1, mod)
ans = ans * 6
ans = ans % mod
print(ans)


from __future__ import division, print_function
import heapq
import os
import copy
import sys
from io import BytesIO, IOBase
from typing import Counter, DefaultDict, Deque, OrderedDict
import bisect, math, time
if sys.version_info[0] < 3:
	from __builtin__ import xrange as range
	from future_builtins import ascii, filter, hex, map, oct, zip
from math import ceil, log2
MOD = 1000000007

def power(x, y):
	if y == 0:
		return 1
	if x == 0:
		return 0
	temp = power(x, y // 2)
	if y % 2 == 0:
		return temp * temp % MOD
	else:
		return x * temp * temp % MOD

def main():
	n = int(input())
	print(6 * power(4, 2 ** n - 2) % MOD)
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):
	(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')
main()


kkkk = int(input())
print(6 * pow(4, pow(2, kkkk) - 2, 1000000007) % 1000000007)


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 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
n = int(input())
mod = 1000000007
ans = 2 ** n
ans -= 2
b = str(ans)
remainderB = 0
for i in range(len(b)):
	remainderB = (remainderB * 10 + ord(b[i]) - 48) % (mod - 1)
final = power(4, remainderB, mod)
final %= mod
final *= 6
final %= mod
print(final)


k = int(input())
n = pow(2, k) - 2
s = 6 * pow(4, n, 10 ** 9 + 7)
print(s % (10 ** 9 + 7))


import sys
input = sys.stdin.readline
mod = 1000000007
pro = 6
n = int(input())
pro = pro * pow(4, (1 << n) - 2, mod)
pro %= mod
print(pro)


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

def fun():
	k = int(input())
	inf = int(1000000000.0 + 7)
	t1 = pow(2, k)
	t1 -= 2
	t2 = power(4, t1, inf)
	print(t2 * 6 % inf)
	pass
fun()


n = int(input())
md = 1000000007
othernodes = (1 << n) - 2
ans = pow(4, othernodes, md)
ans = ans * 6 % md
print(ans)


import collections
import sys
import io, os
import math
from heapq import *
gcd = math.gcd
sqrt = math.sqrt

def ceil(a, b):
	a = -a
	k = a // b
	k = -k
	return k
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline

def strinp(testcases):
	k = 5
	if testcases == -1 or testcases == 1:
		k = 1
	f = str(input())
	f = f[2:len(f) - k]
	return f

def lcm(l):
	ans = l[0]
	for i in range(1, len(l)):
		ans = ans * l[i] // gcd(ans, l[i])
	return ans

def main():
	t = 1
	for _ in range(t):
		k = int(input())
		mod = 10 ** 9 + 7
		tot = pow(2, k) - 1
		ans = 6 * pow(4, tot - 1, mod)
		ans %= mod
		print(ans)
main()


n = int(input())
nodes = 2 ** n
nodes = nodes - 2
res = pow(4, nodes, 1000000007)
res = res * 6 % 1000000007
print(res)


n = int(input())
MOD = 10 ** 9 + 7
p = 6
for i in range(1, n):
	p = p * pow(4, 2 ** i, MOD) % MOD
print(p)


def power(a, b):
	res = 1
	while b:
		if b & 1:
			res = res * a % 1000000007
		a = a * a % 1000000007
		b >>= 1
	return res
h = int(input())
x = 2 ** h - 2
print(6 * power(4, x) % 1000000007)


import time
import os, sys
from datetime import datetime
from math import floor, sqrt, gcd, factorial, ceil, log2
from collections import Counter, defaultdict
import bisect
from itertools import chain
from collections import deque
from sys import maxsize as INT_MAX
from itertools import permutations
from collections import deque
(ONLINE_JUDGE, INF, mod) = (False, float('inf'), int(1000000000.0) + 7)
if os.path.exists('D:\\vimstuff'):
	ONLINE_JUDGE = True
	sys.stdin = open('D:\\vimstuff\\inp.txt', 'r')
	sys.stdout = open('D:\\vimstuff\\out.txt', 'w')

def readint():
	return int(sys.stdin.readline())

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

def readlst():
	return list(map(int, sys.stdin.readline().strip().split()))

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

def mulfloat():
	return map(float, sys.stdin.readline().strip().split())

def flush():
	return sys.stdout.flush()

def power_two(x):
	return 1 << x

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

def countGreater(arr, n, k):
	l = 0
	r = n - 1
	leftGreater = n
	while l <= r:
		m = int(l + (r - l) / 2)
		if arr[m] >= k:
			leftGreater = m
			r = m - 1
		else:
			l = m + 1
			return n - leftGreater

def lower_bound(arr, n, val):
	(l, r) = (-1, n)
	while r > l + 1:
		m = int(l + r >> 1)
		if arr[m] < val:
			l = m
		else:
			r = m
	return r

def upper_bound(arr, n, val):
	(l, r) = (-1, n)
	while r > l + 1:
		m = int(l + r >> 1)
		if arr[m] <= val:
			l = m
		else:
			r = m
	return l

def binpow(a, n, mod):
	res = 1
	while n:
		if n & 1:
			res = res * a % mod
			n -= 1
		a = a * a % mod
		n = n >> 1
	return res

def printmat(l, seperate=True):
	for i in range(0, len(l)):
		if seperate:
			print(*l[i], sep=' ')
		else:
			print(*l[i], sep='')

def is_perfect_square(num):
	temp = num ** 0.5
	return temp // 1 == temp

def find(res):
	n1 = res
	while par[n1] != n1:
		par[n1] = par[par[n1]]
		n1 = par[n1]
	return n1

def union(u, v):
	(p1, p2) = (find(u), find(v))
	if p1 == p2:
		return 0
	if rank[p1] > rank[p2]:
		(p1, p2) = (p2, p1)
	par[p1] = p2
	rank[p2] += rank[p1]
	return 1

def john_3_16():
	n = readint()
	num_node = 2 ** n
	ans = binpow(4, num_node - 2, mod)
	ans = ans * 6 % mod
	print(ans)
	return

def main():
	tc = 1
	start = time.time()
	while tc:
		john_3_16()
		tc -= 1
	if ONLINE_JUDGE:
		print(f'{(time.time() - start) * 1000}ms')
		pass
main()


def ans2(k, prev):
	return 6 * prev
MOD = 10 ** 9 + 7
k = int(input())
prev = 1
for i in range(k - 1):
	prev = (4 * prev) ** 2 % MOD
res = ans2(k, prev) % MOD
print(res)


tree = int(input())
print(6 * pow(4, pow(2, tree) - 2, 1000000007) % 1000000007)


mod = 10 ** 9 + 7

def bin_exp(n, p):
	ans = 1
	while p:
		if p & 1:
			ans = ans * n % mod
		n = n * n % mod
		p >>= 1
	return ans
n = int(input())
nodes = (1 << n) - 2
print(6 * bin_exp(4, nodes) % mod)


MOD = int(1000000000.0 + 7)
n = int(input())
total = pow(2, n) - 1
ans = 6 * pow(4, total - 1, MOD)
print(ans % MOD)


print(pow(4, 2 ** int(input()) - 2, int(1000000000.0 + 7)) * 6 % int(1000000000.0 + 7))


def rubiks_coloring(k):
	n = 1
	modulo = 10 ** 9 + 7
	for _ in range(k - 1):
		n = 4 * n * n
		n %= modulo
	n = 6 * n * n
	n %= modulo
	return n
k = int(input())
print(rubiks_coloring(k))


import sys
import math
import bisect
from sys import stdin, stdout
from math import gcd, floor, sqrt, log2, ceil
from collections import defaultdict as dd
from bisect import bisect_left as bl, bisect_right as br
from bisect import insort
from collections import Counter
from collections import deque
from heapq import heappush, heappop, heapify
from itertools import permutations, combinations
from itertools import accumulate as ac
from random import randint as ri
mod = int(1000000000.0) + 7
ip = lambda : int(stdin.readline())
inp = lambda : map(int, stdin.readline().split())
ips = lambda : stdin.readline().rstrip()
out = lambda x: stdout.write(str(x) + '\n')
t = 1
for _ in range(t):
	n = ip()
	tot = 2 ** n - 1
	ans = 6
	tot -= 1
	ans *= pow(4, tot, mod)
	ans %= mod
	print(ans)


from math import log
n = int(input())
x = 2 ** n - 2
cnt = pow(4, x, 1000000007)
print(cnt * 6 % 1000000007)


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')
k = int(input())
total_nodes = 2 ** k - 1
mod = 10 ** 9 + 7
ans = pow(4, total_nodes - 1, mod) * 6 % mod
print(ans)


n = int(input())
x = 4
for i in range(n):
	x **= 2
	x %= 10 ** 9 + 7
print(375000003 * x % (10 ** 9 + 7))


ESP = 1000000007
k = int(input())
print(6 * pow(4, 2 ** k - 2, ESP) % ESP)


MOD = 1000000007
print(6 * pow(4, pow(2, eval(input())) - 2, MOD) % MOD)


mod = 1000000007
n = int(input())
ans = 6
val = 16
for i in range(1, n):
	ans = ans * val % mod
	val = val * val % mod
print(ans)


def solve():
	n = int(input())
	if n == 1:
		print(6)
		return
	nodes = 1
	ans = 6 * 4 * 4
	mod = 10 ** 9 + 7
	temp = 16
	for i in range(2, n):
		temp = temp * temp % mod
		ans = ans * temp % mod
	print(ans % mod)
t = 1
for i in range(t):
	solve()


import math
n = int(input())
l = [16]
for i in range(62):
	l.append(l[-1] * l[-1] % (10 ** 9 + 7))
ans = 6
for i in range(1, n):
	ans *= l[i - 1]
	ans = ans % (10 ** 9 + 7)
print(ans)


import sys
input = sys.stdin.readline

def iinput():
	return int(input())

def sinput():
	return input().rstrip()

def i0input():
	return int(input()) - 1

def linput():
	return list(input().split())

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

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

def li0input():
	return list(map(lambda x: int(x) - 1, input().split()))

def mi0input():
	return map(lambda x: int(x) - 1, input().split())
INF = 10 ** 20
MOD = 1000000007

def modpow(a: int, p: int, mod: int) -> int:
	if p == 0:
		return 1
	if p % 2 == 0:
		half = modpow(a, p // 2, mod)
		return half * half % mod
	else:
		return a * modpow(a, p - 1, mod) % mod
k = iinput()
ans = modpow(4, 2 ** k - 2, MOD)
ans *= 6
ans %= MOD
print(ans)


mod = 1000000007
n = int(input())
out = 6
value = 16
for i in range(1, n):
	out = out * value % mod
	value = value * value % mod
print(out)


z = int(input())
print(6 * pow(4, pow(2, z) - 2, 1000000007) % 1000000007)


import os, sys
input = lambda : sys.stdin.buffer.readline().rstrip(b'\r\n')

def dbp(*args, **kwargs):
	print(*args, file=sys.stderr, **kwargs)
a_str = lambda : input().decode('ascii')
get_int_list = lambda : [int(x) for x in input().split()]
join_str = lambda l, ch=' ': ch.join((str(x) for x in l))
MOD = 10 ** 9 + 7

def do_thing():
	n = int(input())
	ans = 6
	stc = 1
	for i in range(1, n):
		stc *= 2
		ans = ans * pow(4, stc, MOD) % MOD
	return ans
maxcc = 1
for cc in range(maxcc):
	print(do_thing())


import sys

def readstr():
	return sys.stdin.readline().strip()

def readint():
	return int(readstr())

def readints():
	return list(map(int, readstr().split()))
M = 10 ** 9 + 7

def pow(k):
	if k == 0:
		return 1
	r = 1 + k % 2
	a = pow(k // 2)
	return r * a % M * a % M

def solve(n):
	p = (1 << n + 1) - 4
	return 6 * pow(p) % M

def main():
	n = readint()
	print(solve(n))
main()


import sys
input = sys.stdin.readline
M = 1000000007
k = int(input())
x = 2 ** k - 1
print(6 * pow(4, x - 1, M) % M)


from collections import Counter, defaultdict, deque
from sys import stdin, stdout
from heapq import heapify, heappop, heappush
import io, os, sys
input = stdin.readline
from collections import OrderedDict
from bisect import bisect_left, bisect_right
mod = 10 ** 9 + 7

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

def listinput():
	return [int(i) for i in input().split()]

def intinput():
	return int(input())

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

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 * 2, n + 1, p):
				prime[i] = False
		p += 1
	prime[0] = False
	prime[1] = False
	ans = []
	for p in range(n + 1):
		if prime[p]:
			ans.append(p)
	return ans

def writ(ss):
	stdout.write(str(ss) + '\n')

def mult(a, b, mod):
	return a % mod * (b % mod) % mod
mod = 10 ** 9 + 7
for test in range(1):

	def solve():
		n = intinput()
		n = 2 ** n - 1
		ans = 6 * pow(4, n - 1, mod)
		return ans % mod
	writ(solve())


import sys
input = iter(sys.stdin.read().splitlines()).__next__
MOD = 10 ** 9 + 7
k = int(input())
num_non_root_nodes = pow(2, k, MOD - 1) - 2
print(6 * pow(4, num_non_root_nodes, MOD) % MOD)


m = 1000000007
k = int(input())
ans = 1
for i in range(k - 1):
	ans = (ans * 4) ** 2 % m
print(6 * ans % m)


n = int(input())
ans = (1 << n) - 2
mod = 10 ** 9 + 7
answer = 1
mod_dp = [4 ** 2]
for i in range(2, n):
	mod4power = mod_dp[-1] * mod_dp[-1] * mod_dp[0] % mod
	mod_dp.append(mod4power)
if n == 1:
	print(6)
elif n == 2:
	print(96)
else:
	print(6 * mod_dp[-1] % mod)


n = int(input())
mod = 1000000007

def qmi(x, y):
	ans = 1
	base = x
	while y > 0:
		if y & 1:
			ans *= base
		base *= base
		y >>= 1
	return ans
print(6 * pow(4, qmi(2, n) - 2, mod) % mod)


import sys
MOD = int(1000000000.0 + 7)

def solve():
	inp = sys.stdin.readline
	n = int(inp())
	dp = [0] * n
	dp[0] = 1
	for i in range(1, n):
		dp[i] = dp[i - 1] * 4 * dp[i - 1] * 4 % MOD
	print(dp[n - 1] * 6 % MOD)

def main():
	solve()
main()


import os, sys
from io import BytesIO, IOBase
from types import GeneratorType
from bisect import *
from collections import defaultdict, deque, Counter
import math, string
from heapq import *
from operator import add
from itertools import accumulate
BUFSIZE = 8192
sys.setrecursionlimit(10 ** 5)

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')
inf = float('inf')
en = lambda x: list(enumerate(x))
ceil_ = lambda a, b: (a + b - 1) // b
ii = lambda : int(input())
r = lambda : map(int, input().split())
rr = lambda : list(r())
n = ii()
mod = 10 ** 9 + 7
ans = 6 * pow(4, (1 << n) - 2, mod) % mod
print(ans)


from sys import *
input = stdin.readline
import threading
from bisect import *
import math
from collections import *
import operator
from heapq import *
from itertools import *
inf = 10 ** 19
mod = 10 ** 9 + 7
MOD = 998244353
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
drow = [0, 1, 0, -1]
dcol = [-1, 0, 1, 0]
setrecursionlimit(200005)

def asc(c):
	return ord(c) - 97 + 1
n = int(input())
ans = 6
ans = ans * pow(4, pow(2, n) - 2, mod) % mod
print(ans % mod)


n = int(input())
node = 2 ** n - 1

def fast_pow(a, b):
	res = 1
	while b:
		if b & 1:
			res = res * a % 1000000007
		a = a * a % 1000000007
		b >>= 1
	return res
res = fast_pow(4, node - 1) * 6 % 1000000007
print(res)


n = int(input())
vid = 6
k = 2
m = int(1000000000.0 + 7)
for i in range(n - 1):
	vid = vid * pow(4, k, m) % m
	k *= 2
print(vid)


k = int(input())
MOD = 10 ** 9 + 7
ans = 6
for i in range(1, k):
	ans *= pow(4, 2 ** i, MOD)
	ans %= MOD
print(ans)


MOD = 10 ** 9 + 7
k = int(input())
cnt = pow(2, k) - 1
ans = pow(4, cnt - 1, MOD) * 6 % MOD
print(ans)


def luythua(n, k):
	ans = 1
	for i in range(0, k):
		ans = ans * n % (10 ** 9 + 7)
	return ans
n = int(input())
tich = 1
for i in range(1, n):
	somumoi = pow(2, i, 10 ** 9 + 6)
	tich = tich * pow(4, somumoi, 10 ** 9 + 7)
tich = tich * 6 % (10 ** 9 + 7)
print(tich)


MOD = 1000000007

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

def solution(k):
	exp = (1 << k) - 2
	ans = power(4, exp)
	ans *= 6
	return ans % MOD
k = int(input())
ans = solution(k)
print(ans)


def power_of_4(pow):
	if pow == 0:
		return 1
	elif pow == 1:
		return 4
	else:
		p = power_of_4(pow // 2)
		if pow % 2 == 0:
			return p * p % 1000000007
		else:
			return p * p * 4 % 1000000007
n = int(input())
numNodes = 2 ** n - 1
ans = 6
print(ans * power_of_4(numNodes - 1) % 1000000007)


def main():
	k = int(input())
	if k == 1:
		print(6)
		return
	p = 2 ** k - 2
	print(6 * pow(4, p, 1000000000 + 7) % (1000000000 + 7))
main()


import sys
import bisect
from bisect import bisect_left as lb
from bisect import bisect_right as rb
input_ = lambda : sys.stdin.readline().strip('\r\n')
from math import log
from math import gcd
from math import atan2, acos
from random import randint
sa = lambda : input_()
sb = lambda : int(input_())
sc = lambda : input_().split()
sd = lambda : list(map(int, input_().split()))
sflo = lambda : list(map(float, input_().split()))
se = lambda : float(input_())
sf = lambda : list(input_())
flsh = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
mod1 = 998244353
gp = []
cost = []
dp = []
mx = []
ans1 = []
ans2 = []
special = []
specnode = []
a = 0
kthpar = []

def dfs2(root, par):
	if par != -1:
		dp[root] = dp[par] + 1
	for i in range(1, 20):
		if kthpar[root][i - 1] != -1:
			kthpar[root][i] = kthpar[kthpar[root][i - 1]][i - 1]
	for child in gp[root]:
		if child == par:
			continue
		kthpar[child][0] = root
		dfs(child, root)
ans = 0
a = []
(n, k) = (0, 0)
b = []
vis = []
tot = 0
time = []
time1 = []
adj = []
mx = -1
eps = 1e-07
x = 0
pref = []
lvl = []

def update_it(bit, i, val):
	n = len(bit)
	while i < n:
		bit[i] += val
		i += i & -i

def get_ans(bit, i):
	n = len(bit)
	tot = 0
	while i > 0:
		tot += bit[i]
		i -= i & -i
	return tot

def hnbhai(tc):
	n = sb()
	tot = 2 ** n - 1
	print(6 * pow(4, tot - 1, mod) % mod)
for _ in range(1):
	hnbhai(_ + 1)


def func():
	total = pow(2, k) - 1
	ans = 6 * pow(4, total - 1, mod)
	print(ans % mod)
mod = 10 ** 9 + 7
k = int(input())
func()


import sys
input = sys.stdin.readline
k = int(input())
rem = 1000000007
if k == 1:
	print(6)
else:
	st = 16
	tem = []
	for i in range(k - 1):
		tem.append(st)
		st = st * st % rem
	ans = 1
	for i in tem:
		ans = ans * i % rem
	print(6 * ans % rem)


mod = int(1000000000.0 + 7)

def ksm(a: int, k: int) -> int:
	res = 1
	while k > 0:
		if k & 1:
			res = res * a % mod
		a = a * a % mod
		k >>= 1
	return res

def main() -> None:
	n = int(input())
	print(ksm(4, (1 << n) - 2) * 6 % mod)
main()


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

def pow(x, y):
	res = 1
	x = x
	if x == 0:
		return 0
	while y > 0:
		if y & 1 == 1:
			res = res * x
		y = y >> 1
		x = x * x
	return res
n = int(input())
nodes = pow(2, n) - 2
mod = 1000000000 + 7
ans1 = power(4, nodes, mod)
ans1 *= 6
ans1 %= mod
print(ans1)


import sys
import math
import heapq
import bisect
from collections import Counter
from collections import defaultdict
from io import BytesIO, IOBase
from itertools import permutations
import string

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
		self.BUFSIZE = 8192

	def read(self):
		while True:
			b = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.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, self.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')

def get_int():
	return int(input())

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

def get_int_grid(n):
	return [get_ints() for _ in range(n)]

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

def get_strs():
	return get_str().split(' ')

def flat_list(arr):
	return [item for subarr in arr for item in subarr]

def yes_no(b):
	if b:
		return 'YES'
	else:
		return 'NO'

def binary_search(good, left, right, delta=1, right_true=False):
	limits = [left, right]
	while limits[1] - limits[0] > delta:
		if delta == 1:
			mid = sum(limits) // 2
		else:
			mid = sum(limits) / 2
		if good(mid):
			limits[int(right_true)] = mid
		else:
			limits[int(~right_true)] = mid
	if good(limits[int(right_true)]):
		return limits[int(right_true)]
	else:
		return False

def prefix_sums(a):
	p = [0]
	for x in a:
		p.append(p[-1] + x)
	return p

def solve_a():
	n = get_int()
	return (-(n - 1), n)

def solve_b():
	(n, k) = get_ints()
	M = 10 ** 9 + 7
	cnt = 0
	ans = 0
	while k:
		if k % 2:
			ans += pow(n, cnt, M)
			ans %= M
		cnt += 1
		k //= 2
	return ans

def solve_c():
	(n, c) = get_strs()
	n = int(n)
	s = list(get_str())
	if s.count(c) == n:
		print(0)
		return
	for i in range(2, n + 1):
		b = True
		for x in range(i - 1, n, i):
			if s[x] != c:
				b = False
				break
		if b:
			print(1)
			print(i)
			return
	print(2)
	print(n - 1, n)
	return

def solve_e():
	k = get_int()
	M = 10 ** 9 + 7
	return 6 * pow(4, pow(2, k) - 2, M) % M
print(solve_e())


mod = 10 ** 9 + 7

def pow(a, b):
	if a == 0:
		return 0
	if b == 0:
		return 1
	if a == 1:
		return 1
	ans = pow(a, b >> 1)
	if b % 2 == 0:
		return ans % mod * (ans % mod) % mod
	else:
		return ans % mod * (ans % mod) * (a % mod) % mod
k = int(input())
print(pow(4, (1 << k) - 2) * 6 % mod)


import sys, io, os
import math
mod = 1000000007

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

def main():
	n = int(input())
	sum = 1
	x = int(pow(2, n)) - 1
	sum = pow(4, x - 1, mod)
	print(sum * 6 % mod)
for _ in range(1):
	main()


k = int(input())
module = 10 ** 9 + 7
ans = 6
for num in range(1, k):
	ans = ans * pow(4, pow(2, num), module) % module
print(ans)


n = int(input())
modd = 1000000007
nodes = pow(2, n) - 1
ans1 = pow(4, nodes - 1, modd)
print(ans1 * 6 % modd)


def solve(n):
	mod = 10 ** 9 + 7
	if n == 1:
		return 6
	dp4 = [0] * (n + 1)
	dp4[0] = 4
	for i in range(1, n):
		dp4[i] = 4 * dp4[i - 1] * dp4[i - 1] % mod
	return 6 * dp4[n - 2] * dp4[n - 2] % mod
import os
import io
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
n = int(input().decode().strip())
resa = solve(n)
print(resa)


n = int(input())
k = pow(2, n) - 2
ans = pow(4, k, 1000000007)
print(ans * 6 % 1000000007)


n = int(input())
ans = 6
for i in range(1, n):
	ans = ans * pow(4, 2 ** i, mod=10 ** 9 + 7) % (10 ** 9 + 7)
print(ans)


from collections import defaultdict as df
from collections import deque as dq
from heapq import heappush, heappop

def prime_sieve(n):
	flag = n % 6 == 2
	sieve = bytearray((n // 3 + flag >> 3) + 1)
	for i in range(1, int(n ** 0.5) // 3 + 1):
		if not sieve[i >> 3] >> (i & 7) & 1:
			k = 3 * i + 1 | 1
			for j in range(k * k // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
			for j in range(k * (k - 2 * (i & 1) + 4) // 3, n // 3 + flag, 2 * k):
				sieve[j >> 3] |= 1 << (j & 7)
	return sieve

def prime_list(n):
	res = []
	if n > 1:
		res.append(2)
	if n > 2:
		res.append(3)
	if n > 4:
		sieve = prime_sieve(n + 1)
		res.extend((3 * i + 1 | 1 for i in range(1, (n + 1) // 3 + (n % 6 == 1)) if not sieve[i >> 3] >> (i & 7) & 1))
	return res
mod = 1000000007
from math import ceil
n = int(input())
print(6 * pow(4, 2 ** n - 2, mod) % mod)


MOD = 10 ** 9 + 7
print(6 * pow(4, 2 ** int(input()) - 2, MOD) % MOD)


mod = 10 ** 9 + 7
k = int(input())
temp = 6
for i in range(1, k):
	child = pow(2, i)
	temp = temp % mod * pow(4, child, mod) % mod
print(temp)


m = int(input())
arr = [0 for i in range(m)]
arr[0] = 1
for i in range(1, m):
	arr[i] = 16 * arr[i - 1] * arr[i - 1] % 1000000007
print(6 * arr[-1] % 1000000007)


import traceback
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 = IOWrapper(sys.stdin)
input = lambda : sys.stdin.readline().rstrip('\r\n')

class SortedList:

	def __init__(self, iterable=[], _load=200):
		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):
		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):
		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):
		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):
		_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):
		_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):
		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):
		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):
		_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):
		_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):
		_len = self._len
		self.discard(value)
		if _len == self._len:
			raise ValueError('{0!r} not in list'.format(value))

	def pop(self, index=-1):
		(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):
		(pos, idx) = self._loc_left(value)
		return self._fen_query(pos) + idx

	def bisect_right(self, value):
		(pos, idx) = self._loc_right(value)
		return self._fen_query(pos) + idx

	def count(self, value):
		return self.bisect_right(value) - self.bisect_left(value)

	def __len__(self):
		return self._len

	def __getitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		return self._lists[pos][idx]

	def __delitem__(self, index):
		(pos, idx) = self._fen_findkth(self._len + index if index < 0 else index)
		self._delete(pos, idx)

	def __contains__(self, value):
		_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 (value for _list in self._lists for value in _list)

	def __reversed__(self):
		return (value for _list in reversed(self._lists) for value in reversed(_list))

	def __repr__(self):
		return 'SortedList({0})'.format(list(self))
import math
from collections import defaultdict as dfd, defaultdict, Counter, deque
from functools import lru_cache
from itertools import accumulate
from heapq import *
import bisect

def geti():
	return int(input())

def gets():
	return input()

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

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

def getinps(s):
	inps = s.split()
	m = {'i': geti, 's': gets, 'il': getil, 'sl': getsl}
	if len(inps) == 1:
		return m[s]()
	return [m[k]() for k in inps]

def get2d(nrows, ncols, n=0):
	return [[n] * ncols for r in range(nrows)]

def get_acc(a):
	return list(accumulate(a))

def get_ncr(n, r, mod=10 ** 9 + 7):
	num = den = 1
	r = min(r, n - r)
	for i in range(r):
		num = num * (n - i) % mod
		den = den * (i + 1) % mod
	return num * pow(den, mod - 2, mod) % mod

def get_nc2(n):
	return n * (n - 1) // 2

def get_npr(n, r):
	if n < r:
		return 0
	return math.factorial(n) // math.factorial(r)

def put(a):
	return ' '.join(map(str, a))
ALPHABETS = 'abcdefghijklmnopqrstuvwxyz'
VOWELS = 'aeiou'
CONSONANTS = 'bcdfghjklmnpqrstvwxyz'
inf = float('inf')
mod = 10 ** 9 + 7

class Solution:

	def main(self):
		(N,) = getil()
		ans = 6
		ans *= pow(4, 2 ** N - 2, mod)
		ans %= mod
		return ans
try:
	Sol = Solution()
	ans = Sol.main()
	print(ans)
except Exception as e:
	print(e)
	traceback.print_exc()


import sys
input = lambda : sys.stdin.readline().rstrip('\r\n')
inp_vars_int = lambda : map(int, input().split())
inp_list_int = lambda : list(map(int, input().split()))
k = int(input())
res = 6
p = 0
for i in range(1, k):
	p += 2 ** i
m = 10 ** 9 + 7
res *= pow(4, p, m)
print(res % m)


import sys
input = sys.stdin.readline

def solve():
	k = int(input())
	mo = 10 ** 9 + 7
	print(6 * pow(4, 2 ** k - 2, mo) % mo)
solve()


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):
	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():
	n = int(input())
	g = [6]
	b = 4
	for j in range(n - 1):
		b = b * b % 1000000007
		g.append(b)
	sumo = 1
	for j in range(n):
		sumo = sumo * g[j] % 1000000007
	print(sumo)
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')
main()


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

def Ii():
	return int(input())

def infi():
	return float('Inf')

def mino():
	return -1
a = Ii()
a -= 1
z = 4
y = 6
for i in range(a):
	z = z * z
	y *= z
	z %= 1000000007
	y %= 1000000007
if a == 0:
	print(6)
elif a == 1:
	print(6 * 16)
else:
	print(y)


inf = float('inf')
import sys
import pprint
import logging
from logging import getLogger
import array

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

def maps():
	return [int(i) for i in input().split()]
logging.basicConfig(format='%(message)s', level=logging.WARNING)
logger = getLogger(__name__)
logger.setLevel(logging.INFO)

def debug(msg, *args):
	logger.info(f'{msg}={pprint.pformat(args)}')
mod = int(1000000000.0) + 7
(k,) = maps()
print(pow(4, (1 << k) - 2, mod) * 6 % mod)


k = int(input())
mod = 10 ** 9 + 7
dp = [[None for x in range(k + 1)] for x in range(7)]

def solve(level, pre):
	if level == 1:
		return 1
	if dp[pre][level] != None:
		return dp[pre][level]
	ans = 0
	for i in range(1, 7):
		if i != pre and i != 7 - pre:
			ans += solve(level - 1, i)
			ans %= mod
	dp[pre][level] = ans ** 2 % mod
	return dp[pre][level]
ans = 0
for i in range(1, 7):
	ans += solve(k, i)
print(ans % mod)


def powe(a, b, mod):
	if b == 0:
		return 1
	if b == 1:
		return a
	pr = powe(a, b // 2, mod)
	pr *= pr
	pr %= mod
	if b % 2 == 1:
		pr *= a
		pr %= mod
	return pr

def rubiks_cube_coloring():
	p = powe(4, 2 ** int(input()) - 2, 10 ** 9 + 7)
	print(6 * p % (10 ** 9 + 7))
rubiks_cube_coloring()


def main():
	alpha = 'abcdefghijklmnopqrstuvwxyz'
	ALPHA = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
	inf = 1e+17
	mod = 10 ** 9 + 7

	def factorial(n):
		f = 1
		for i in range(1, n + 1):
			f = f * i % mod
		return f

	def ncr(n, r):
		num = den = 1
		for i in range(r):
			num = num * (n - i) % mod
			den = den * (i + 1) % mod
		return num * pow(den, mod - 2, mod) % mod

	def isthere(s, ind, c):
		for i in range(ind, len(s), ind + 1):
			if s[i] != c:
				return False
		return True

	def solve(n):
		ans = 6
		for i in range(1, n):
			ans = ans * pow(4, pow(2, i), mod) % mod
		return ans % mod
		pass
	t = 1
	ans = []
	for _ in range(t):
		n = int(input())
		ans.append(solve(n))
	p = 1
	for answer in ans:
		print(answer)
		p += 1
import sys, threading
import bisect
import math
import itertools
from sys import stdout
import heapq
from queue import PriorityQueue
from collections import deque
input = sys.stdin.readline
thread = threading.Thread(target=main)
thread.start()
thread.join()


n = int(input())
n_ver = 0
mod = pow(10, 9) + 7
for i in range(n):
	n_ver = n_ver + pow(2, i)
res = 6 * pow(4, n_ver - 1, mod) % mod
print(res)


m = int(input())
doi = int(1000000000.0 + 7)
print(pow(4, pow(2, m) - 2, doi) * 6 % doi)


import sys
import io
import math
import collections
import decimal
import itertools
import bisect
import heapq

def input():
	return sys.stdin.readline()[:-1]
INF = 10 ** 10
MOD = 1000000007
K = int(input())
dp = [[0] * 6 for _ in range(K)]
for c in range(6):
	dp[K - 1][c] = 1
for k in reversed(range(K - 1)):
	for c in range(6):
		for c1_1 in range(6):
			for c1_2 in range(6):
				if c1_1 != c and c1_1 != (c + 3) % 6 and (c1_2 != c) and (c1_2 != (c + 3) % 6):
					dp[k][c] = (dp[k][c] + dp[k + 1][c1_1] * dp[k + 1][c1_2]) % MOD
ans = sum(dp[0]) % MOD
print(ans)


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 = int(input())
m = 1000000007
k = 2 ** n - 2
x = power(4, k, m)
print(6 * x % m)


m = 10 ** 9 + 7
n = int(input())
n -= 1
print(6 * pow(4, 2 * (pow(2, n) - 1), m) % m)


import sys
readline = sys.stdin.readline
N = int(readline())
mod = 10 ** 9 + 7
ans = 6 * pow(4, (1 << N) - 2, mod) % mod
print(ans)


n = int(input())
x = pow(2, n) - 2
MOD = 1000000007
y = pow(4, x, MOD)
y = y * 6 % MOD
print(y)


from functools import lru_cache
MOD = 10 ** 9 + 7

def solve(k):
	start = 6
	while k > 1:
		start = start * start * 8 * 333333336
		start %= MOD
		k -= 1
	return start % MOD
print(solve(int(input())))


k = int(input())
MOD = 10 ** 9 + 7
res = 6 * pow(4, pow(2, k) - 2, MOD) % MOD
print(res)


n = int(input())
ans = 6
j = 16
REM = 1000000007
for i in range(1, n):
	ans = ans % REM * (j % REM) % REM
	j = j * j % REM
print(ans)


mod = 10 ** 9 + 7

def main():
	n = int(input())
	x = pow(4, pow(2, n) - 2, mod)
	print(x * 6 % mod)
t = 1
for ii in range(t):
	main()


k = int(input())
res = 4
for i in range(k - 2):
	res = res * res * 4 % 1000000007
if k > 1:
	res = res * res * 6 % 1000000007
else:
	res = 6
print(res)


import sys
input = sys.stdin.readline
mod = 10 ** 9 + 7
k = int(input())
n = pow(2, k) - 1
print(6 * pow(4, n - 1, mod) % mod)


MODULO = 10 ** 9 + 7
x = [4 for _ in range(62)]
for i in range(1, 62):
	x[i] = x[i - 1] ** 2
	x[i] %= MODULO
k = int(input())
a = 6
for i in range(1, k):
	a *= x[i]
	a %= MODULO
print(a)


d = {1: 6, 2: 96, 3: 24576, 4: 610612729, 5: 218379003, 6: 979862110, 7: 47316973, 8: 781894559, 9: 304775472, 10: 153616455, 11: 217549120, 12: 417282843, 13: 915434300, 14: 934234, 15: 115095058, 16: 422120691, 17: 394710257, 18: 374487330, 19: 263582894, 20: 61556388, 21: 672219263, 22: 26965409, 23: 739859600, 24: 681105159, 25: 317561710, 26: 205882741, 27: 653224436, 28: 468274591, 29: 776665722, 30: 686170158, 31: 490502902, 32: 830053173, 33: 491866864, 34: 553769136, 35: 905505924, 36: 425351916, 37: 809070133, 38: 747936966, 39: 182445995, 40: 622757975, 41: 896821809, 42: 914685395, 43: 586027906, 44: 551317088, 45: 715056107, 46: 876956862, 47: 468036582, 48: 151560108, 49: 469809072, 50: 902552662, 51: 282872349, 52: 716427856, 53: 359665739, 54: 79733389, 55: 738462480, 56: 467900233, 57: 690506414, 58: 166788441, 59: 950618124, 60: 937481864}
print(d[int(input())])


from __future__ import division, print_function
import math
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')

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()
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 inlt():
	return list(map(int, input().split()))

def insr():
	s = input().strip()
	return list(s[:len(s)])

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

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
maxn = 10 ** 9 + 7
n = inp()
a = 2 ** n - 2
v = power(4, a, maxn)
print(6 * v % maxn)


import math
MOD = 1000000000 + 7

def modInverse(b, m):
	g = math.gcd(b, m)
	if g != 1:
		return -1
	else:
		return pow(b, m - 2, m)

def modDivide(a, b, m):
	a = a % m
	inv = modInverse(b, m)
	if inv == -1:
		print('Division not defined')
	else:
		return inv * a % m

def s(n):
	if n == 1:
		return 6
	c = s(n - 1)
	return modDivide(c * c * 8, 3, MOD)
n = int(input())
print(s(n))


import bisect
import heapq
import math
import collections
import sys
import copy
from functools import reduce
import decimal
from io import BytesIO, IOBase
import os
import itertools
import functools
from types import GeneratorType
sys.setrecursionlimit(10 ** 9)
decimal.getcontext().rounding = decimal.ROUND_HALF_UP
graphDict = collections.defaultdict
queue = collections.deque

def bootstrap(f, stack=[]):

	def wrappedfunc(*args, **kwargs):
		to = f(*args, **kwargs)
		if stack:
			return to
		else:
			while True:
				if type(to) is GeneratorType:
					stack.append(to)
					to = next(to)
				else:
					stack.pop()
					if not stack:
						return to
					to = stack[-1].send(to)
	return wrappedfunc

class Graphs:

	def __init__(self):
		self.graph = graphDict(set)

	def add_edge(self, u, v):
		self.graph[u].add(v)
		self.graph[v].add(u)

	def dfs_utility(self, nodes, visited_nodes):
		visited_nodes.add(nodes)
		for neighbour in self.graph[nodes]:
			if neighbour not in visited_nodes:
				self.dfs_utility(neighbour, visited_nodes)

	def dfs(self, node):
		Visited = set()
		self.dfs_utility(i, Visited)

	def bfs(self, node, f_node):
		count = float('inf')
		visited = set()
		level = 0
		if node not in visited:
			queue.append([node, level])
			visited.add(node)
		flag = 0
		while queue:
			parent = queue.popleft()
			if parent[0] == f_node:
				flag = 1
				count = min(count, parent[1])
			level = parent[1] + 1
			for item in self.graph[parent[0]]:
				if item not in visited:
					queue.append([item, level])
					visited.add(item)
		return count if flag else -1
		return False

	def solve(self, in_degree):
		c = 0
		tracker = queue()
		ans = graphDict(lambda : 1)
		for ii in range(n):
			if in_degree[ii + 1] == 0:
				tracker.append(ii + 1)
		while tracker:
			node = tracker.popleft()
			c += 1
			for neighbour in self.graph[node]:
				in_degree[neighbour] -= 1
				if neighbour < node:
					ans[neighbour] = max(ans[neighbour], ans[node] + 1)
				else:
					ans[neighbour] = max(ans[neighbour], ans[node])
				if in_degree[neighbour] == 0:
					tracker.append(neighbour)
		if c != n:
			return False
		else:
			return max(ans.values()) if len(ans.values()) > 0 else 1
		return 'Send Help!!!!'

class Tree:

	def __init__(self, data):
		self.data = data
		self.left = None
		self.right = None

def inorder(node, lis):
	if node:
		inorder(node.left, lis)
		lis.append(node.data)
		inorder(node.right, lis)
	return lis

def leaf_node_sum(root):
	if root is None:
		return 0
	if root.left is None and root.right is None:
		return root.data
	return leaf_node_sum(root.left) + leaf_node_sum(root.right)

def hight(root):
	if root is None:
		return -1
	if root.left is None and root.right is None:
		return 0
	return max(hight(root.left), hight(root.right)) + 1

class UF:

	def __init__(self, N):
		self._id = list(range(N))
		self._count = N
		self._rank = [0] * N

	def find(self, p):
		id = self._id
		while p != id[p]:
			p = id[p]
		return p

	def count(self):
		return self._count

	def connected(self, p, q):
		return self.find(p) == self.find(q)

	def union(self, p, q):
		id = self._id
		rank = self._rank
		i = self.find(p)
		j = self.find(q)
		if i == j:
			return
		self._count -= 1
		if rank[i] < rank[j]:
			id[i] = j
		elif rank[i] > rank[j]:
			id[j] = i
		else:
			id[j] = i
			rank[i] += 1

	def add_roads(self):
		return set(self._id)

	def __str__(self):
		return ' '.join([str(x) for x in self._id])

	def __repr__(self):
		return 'UF(' + str(self) + ')'

def rounding(n):
	return int(decimal.Decimal(f'{n}').to_integral_value())

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0), []))

def p_sum(array):
	return list(itertools.accumulate(array))

def diophantine(a: int, b: int, c: int):
	(d, x, y) = extended_gcd(a, b)
	r = c // d
	return (r * x, r * y)

@bootstrap
def extended_gcd(a: int, b: int):
	if b == 0:
		(d, x, y) = (a, 1, 0)
	else:
		(d, p, q) = (yield extended_gcd(b, a % b))
		x = q
		y = p - q * (a // b)
	yield (d, x, y)
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, **kwargs):
		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))

def inp():
	return sys.stdin.readline().strip()

def map_inp(v_type):
	return map(v_type, inp().split())

def list_inp(v_type):
	return list(map_inp(v_type))
mod = 10 ** 9 + 7
n = int(inp())
temp = pow(2, n, mod - 1) % mod
ans = pow(4, temp - 2, mod) * 6
print(ans % mod)


from sys import stdin, stdout, setrecursionlimit
from io import BytesIO, IOBase
from collections import Counter, deque, defaultdict
setrecursionlimit(10000)

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
		self.BUFSIZE = 8192

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

	def readline(self):
		while self.newlines == 0:
			a = self.os.read(self._fd, max(self.os.fstat(self._fd).st_size, self.BUFSIZE))
			self.newlines = a.count(b'\n') + (not a)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(a), 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')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))
input = lambda : stdin.readline().rstrip('\r\n')
inp = lambda : int(input())
st = lambda : input().strip()
jn = lambda x, l: x.join(map(str, l))
int_arr = lambda : list(map(int, input().strip().split()))
str_arr = lambda : list(map(str, input().split()))
get_str = lambda : map(str, input().strip().split())
get_int = lambda : map(int, input().strip().split())
get_float = lambda : map(float, input().strip().split())
mod = 1000000007

def p(x, y, z=mod):
	ans = 1
	x = x % z
	if x == 0:
		return 0
	while y > 0:
		if y & 1:
			ans = ans * x % z
		y = y >> 1
		x = x * x % z
	return ans
n = inp()
res = 16
ans = 6 * 4 * 4
if n == 1:
	print(6)
elif n == 2:
	print(6 * 4 * 4)
else:
	for i in range(3, n + 1):
		res = res ** 2 % mod
		ans = ans * res % mod
	print(ans)


import sys
input = sys.stdin.readline
n = int(input())
print(pow(4, 2 ** n - 2, 10 ** 9 + 7) * 6 % (10 ** 9 + 7))


from sys import stdin, stdout
input = stdin.readline
mod = 10 ** 9 + 7
t = 1
for _ in range(t):
	k = int(input())
	ans = 6 * pow(4, pow(2, k) - 2, mod)
	print(ans % mod)


print(str(6 * pow(4, pow(2, int(input())) - 2, 1000000007) % 1000000007))


import sys, io, os
input = sys.stdin.readline
MOD = 10 ** 9 + 7
f = {}

def compute_power(factor):
	if factor in f:
		return f[factor] % MOD
	if factor == 0:
		f[0] = 1
		return 1
	if factor == 1:
		f[factor] = 16
		return 16
	if factor % 2 == 0:
		f[factor] = compute_power(factor // 2)
		return f[factor] ** 2 % MOD
	else:
		f[factor] = compute_power(factor // 2)
		return 16 * f[factor] ** 2 % MOD

def solve():
	k = int(input())
	print(6 * compute_power(2 ** (k - 1) - 1) % MOD)
solve()


from sys import stdin, stdout
from collections import defaultdict, Counter
import bisect
import math
input = stdin.readline

def inp():
	return map(str, input().split())
mod = 10 ** 9 + 7
for _ in range(1):
	n = int(input())
	ans = 6
	m = pow(2, n) - 2
	k = pow(4, m, mod)
	ans *= k
	ans %= mod
	print(ans)


MOD = 1000000007

def binpow(a, b, m):
	a = a % m
	res = 1
	while b > 0:
		if b & 1:
			res = res * a % m
		a = a * a % m
		b >>= 1
	return res
k = int(input())
if k == 1:
	print(6)
else:
	t1 = -1 * (1 - pow(2, k)) - 1
	t = binpow(4, t1, MOD) * 6 % MOD
	print(t)


md = 10 ** 9 + 7
h = {0: 4}
for i in range(1, 61):
	h[i] = h[i - 1] * h[i - 1] % md
k = int(input())
count = 6
for i in range(1, k):
	count *= h[i]
	count %= md
print(count % md)


import math
mod = 10 ** 9 + 7
n = int(input())
d = 2 ** n - 2
print(6 * pow(4, d, mod) % mod)


M = 10 ** 9 + 7

def binpowmodulus(a, b, M):
	if b == 1:
		return a % M
	if b == 0:
		return 1
	if b % 2 == 0:
		ans = binpowmodulus(a, b // 2, M)
		return ans * ans % M
	else:
		ans = binpowmodulus(a, (b - 1) // 2, M)
		return ans * a % M * ans % M
k = int(input())
k = 2 ** k - 1
print(6 * binpowmodulus(4, k - 1, M) % M)


import os
import sys
import math
import collections
import functools
import itertools
import heapq
import bisect
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 = 'abcde'
MOD = 10 ** 9 + 7
EPS = 1e-06
INF = 10 ** 18

def Ceil(a, b):
	return a // b + int(a % b > 0)

def INT():
	return int(input())

def STR():
	return input()

def INTS():
	return tuple(map(int, input().split()))

def ARRINT():
	return [int(i) for i in input().split()]

def ARRSTR():
	return [i for i in input().split()]
k = INT()
n = 2 ** k - 2
res = 6 * pow(4, n, MOD)
print(res % MOD)


ji = int(input())
oppp = 1000000007
print(6 * pow(4, pow(2, ji) - 1 - 1 + 1 - 1, oppp) % oppp)


for _ in range(1):
	k = int(input())
	print(pow(4, pow(2, k) - 2, 10 ** 9 + 7) * 6 % (10 ** 9 + 7))


import math
k = int(input())
n = math.pow(2, k) - 1
ans = 3
j = 2
for i in range(k):
	ans = ans * j % 1000000007
	j = j * j % 1000000007
f = 1
i = k
while i > 1:
	f = f * f % 1000000007
	f = 2 * f % 1000000007
	i -= 1
f = f * f % 1000000007
ans = ans * f % 1000000007
print(int(ans))


def fastpow(a, n, mod):
	if n == 0:
		return 1
	if n % 2 == 0:
		temp = fastpow(a, n // 2, mod)
		return temp * temp % mod
	else:
		return a * fastpow(a, n - 1, mod) % mod
m = 1000000007
k = int(input())
a = fastpow(4, 2 ** k - 2, m)
a = 6 * a % m
print(a)


from sys import stdin
input = stdin.readline
rn = lambda : int(input())
rns = lambda : map(int, input().split())
rl = lambda : list(map(int, input().split()))
rs = lambda : input().strip()
YN = lambda x: print('YES') if x else print('NO')
mod = 10 ** 9 + 7
k = rn()
ans = 6
p = 2 ** k - 2
ans *= pow(4, p, mod)
print(ans % mod)


class Comba:

	def __init__(self, mod):
		self.fact = array.array('i', [0] * MX)
		self.fact[0] = 1
		self.fact_inv = array.array('i', [0] * MX)
		self.mod = mod
		for i in range(1, MX):
			self.fact[i] = self.fact[i - 1] * i % self.mod
		self.fact_inv[MX - 1] = pow(self.fact[MX - 1], self.mod - 2, self.mod)
		for i in range(MX - 2, -1, -1):
			self.fact_inv[i] = self.fact_inv[i + 1] * (i + 1) % self.mod

	def ncr(self, n, r):
		if r > n or n < 0 or r < 0:
			return 0
		return self.fact[n] * self.fact_inv[r] % self.mod * self.fact_inv[n - r] % self.mod

	def npr(self, n, r):
		if r > n or n < 0 or r < 0:
			return 0
		return self.fact[n] * self.fact_inv[n - r] % self.mod

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

def rw_file():
	sys.stdin = open('', 'r')
	sys.stdout = open('', 'w')

def re(data=str):
	return data(sys.stdin.readline().rstrip())

def mp(data=str):
	return map(data, sys.stdin.readline().split())
import sys, array
from bisect import bisect_left, bisect_right, insort_left
from math import ceil, floor, log, sqrt, gcd
from collections import deque, defaultdict, Counter
from heapq import heappush, heappop, heapify
(mod, mod9, nl, MX) = (1000000007, 998244353, '\n', 200003)

def solve(tc):
	k = re(int)
	ans = 6
	for i in range(1, k):
		ans = ans * pow(4, pow(2, i), mod) % mod
	print(ans)
	return None

def main():
	tests = 1
	for case in range(1, tests + 1):
		solve(case)
main()


print(6 * pow(4, 2 * (2 ** (int(input()) - 1) - 1), 10 ** 9 + 7) % (10 ** 9 + 7))


P = int(1000000000.0 + 7)
n = int(input())
if n == 1:
	print(6)
else:
	cnt = 2 ** n - 2
	ans = pow(4, cnt, P) * 6 % P
	print(ans)


n = int(input())
mod = 10 ** 9 + 7
dp = []
dp.append(6)
for i in range(1, n + 1):
	nums = 2 ** i
	add = pow(4, nums, mod)
	dp.append(dp[-1] * add % mod)
print(dp[n - 1])


k = int(input())
mod = 10 ** 9 + 7

def calc(level):
	if level == 1:
		return 1
	return pow(4 * calc(level - 1), 2, mod)
print(6 * calc(k) % (10 ** 9 + 7))


from sys import stdout, stdin
from io import IOBase, BytesIO
from os import read, write, fstat
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 = read(self._fd, max(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, size: int=...):
		while self.newlines == 0:
			b = read(self._fd, max(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:
			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):
	(sep, file) = (kwargs.pop('sep', ' '), kwargs.pop('file', 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()
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))

def input():
	return stdin.readline().rstrip('\r\n')
MAX_MODULE = 1000000007

def main():
	n = int(input())
	answer = 2 ** n - 2
	answer = pow(4, answer, MAX_MODULE) * 6 % MAX_MODULE
	print(answer)
main()


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')
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 = int(input())
	mod = 10 ** 9 + 7
	print(6 * pow(2, 2 ** (n + 1) - 4, mod) % mod)


import math
big_number = int(1000000000.0 + 7)
a = int(input())

def power(a, b):
	if b == 0:
		return 1
	tmp = power(a, b // 2)
	result = tmp * tmp
	result = result % big_number
	if b % 2 == 1:
		result = result * a
	return result % big_number
m = pow(2, a) - 2
print(6 * power(4, m) % big_number)


m = 10 ** 9 + 7
n = int(input())
t = 2 ** n
t -= 2
answer = pow(4, t, m) * 6 % m
print(answer)


mod = 10 ** 9 + 7
n = int(input())
t = pow(2, n) - 1
a = pow(4, t - 1, mod)
a *= 6
a %= mod
print(a)