N = int(input()) M = int(input()) a = N//1000//M b = N - (a * M) * 1000 c = b//1000 print(a, b, c) def perm(n, k): result = 1 for i in range(1, k + 1): result *= (n - i + 1) result /= i return result print(int(perm(M, c)%1000000000))