def b_hanoi(n):
if n == 1:
return 1
return 2*c_hanoi(n-1) + 1
def c_hanoi(n):
if n == 1:
return 2
return 2*c_hanoi(n-1) + b_hanoi(n-1) + 2
n = int(input())
if n == 1:
return 1
return 2*c_hanoi(n-1) + 1
def c_hanoi(n):
if n == 1:
return 2
return 2*c_hanoi(n-1) + b_hanoi(n-1) + 2
n = int(input())
print(b_hanoi(n)%1000000007,c_hanoi(n)%1000000007)
# 超时,害 一入循环深似海。