N = int(input("N="))
x = float(input('x='))
s = 0
for i in range(1,N+1):
s += ((3*x**2-1)/i)
print(s)
N = int(input("N="))
x = float(input('x='))
s = 0
for i in range(1,N+1):
s += ((3*x**2-1)/i)
print(s)