from math import*

x = eval(input("digite: "))
n = int(input("termos: "))

e = 1
d = 2
i = -1
a = 0
r = 0
while a <= n:
	r =  (x**e/factorial(d))-1 * i
	e = e +1
	d = d + 2
	a = a + 1
print(round(cos(r**0.5,6))

