def fractal_perimeter_area(n, a):
"""Calculates the perimeter and area of a square fractal at level n."""
perimeter = 4 * a * (4.0/3)**n
area = a**2
if n > 0:
for i in range(n):
area += 4 * (a/ (3**(i+1)))**2 * (4**i)
return perimeter, area
n = int(input())
a = int(input())
perimeter, area = fractal_perimeter_area(n, a)
print(f"{perimeter:.10f}")
print(f"{area:.10f}")