a, k = int(input()), int(input())
p = 1
for i in range(-a, a+1):
if i % k == 0 and i:
p *= i
print(p)
a, k = int(input()), int(input())
p = 1
for i in range(-a, a+1):
if i % k == 0 and i:
p *= i
print(p)