There are n students who have taken part in an olympiad. Now it's time to award the students.

Some of them will receive diplomas, some wiil get certificates, and others won't receive anything. Students with diplomas and certificates are called winners. But there are some rules of counting the number of diplomas and certificates. The number of certificates must be exactly k times greater than the number of diplomas. The number of winners must not be greater than half of the number of all students (i.e. not be greater than half of n). It's possible that there are no winners.

You have to identify the maximum possible number of winners, according to these rules. Also for this case you have to calculate the number of students with diplomas, the number of students with certificates and the number of students who are not winners.


-----Input-----

The first (and the only) line of input contains two integers n and k (1 ≤ n, k ≤ 10^12), where n is the number of students and k is the ratio between the number of certificates and the number of diplomas.


-----Output-----

Output three numbers: the number of students with diplomas, the number of students with certificates and the number of students who are not winners in case when the number of winners is maximum possible.

It's possible that there are no winners.


-----Examples-----
Input
18 2

Output
3 6 9

Input
9 10

Output
0 0 9

Input
1000000000000 5

Output
83333333333 416666666665 500000000002

Input
1000000000000 499999999999

Output
1 499999999999 500000000000

Difficulty: EASY
Tags: Mathematics

Implementation

Starter code:

Solutions:
(n, k) = list(map(int, input().split()))
d = int(n // (2 * k + 2))
c = k * d
s = n - c - d
print(d, c, s)


(n, k) = map(int, input().strip().split(' '))
w = int(n / 2)
x = int(w / (k + 1))
print(str(x) + ' ' + str(int(x * k)) + ' ' + str(int(n - x - x * k)))


(n, k) = map(int, input().split())
if n // 2 == n / 2:
	t = n // 2
	n -= t
	t += n % (k + 1)
	n -= n % (k + 1)
	n //= k + 1
	print('{} {} {}'.format(n, k * n, t))
else:
	t = n // 2 + 1
	n -= t
	t += n % (k + 1)
	n -= n % (k + 1)
	n //= k + 1
	print('{} {} {}'.format(n, k * n, t))


(n, k) = map(int, input().split())
a = n // 2 // (1 + k)
print(a, a * k, n - a * (1 + k))


(n, k) = map(int, input().split())
r = n // 2
r //= k + 1
print(r, r * k, n - r - r * k)


s = input()
l = s.split(' ')
count_of_members = int(l[0])
ratio = int(l[1])
count_of_win = count_of_members // 2
s = count_of_win // (ratio + 1)
l = s * ratio
r = count_of_members - l - s
(print(s),)
(print(l),)
print(r)


import sys
import math
get_string = lambda : sys.stdin.readline().strip()
get_int_list = lambda : list(map(int, sys.stdin.readline().strip().split()))
get_int = lambda : int(sys.stdin.readline())
pt = lambda x: sys.stdout.write(str(x) + '\n')
(n, k) = get_int_list()
x = n // (k + 1)
t = min(x * (k + 1), n // 2)
x = t // (k + 1)
print(x, k * x, n - (k + 1) * x)


(n, k) = map(int, input().split())
d = n // 2 // (k + 1)
c = k * d
print(d, c, n - d - c)


(n, k) = map(int, input().split())
x = n // (2 * (k + 1))
y = x * k
z = n - (x + y)
print(x, y, z)


(n, k) = list(map(int, input().split()))
m = n // 2
x = m // (k + 1)
print(x, k * x, n - x - k * x)


import sys
import math

def get_ints():
	return map(int, input().strip().split())

def get_list():
	return list(get_ints())

def printspx(*args):
	return print(*args, end='')

def printsp(*args):
	return print(*args, end=' ')

def printchk(*args):
	return print(*args, end=' \\ ')
MODPRIME = int(1000000000.0 + 7)
BABYMODPR = 998244353
(n, k) = get_ints()
a = n // 2 // (k + 1)
print(a, a * k, n - (k + 1) * a)


(n, k) = map(int, input().split())
n1 = n // 2
L = 0
R = n1 // k
if k >= n1:
	print(0, 0, n)
else:
	while L + 1 <= R:
		M = (R + L) // 2
		if L * (k + 1) < n1:
			if n1 - L * (k + 1) < k:
				break
			L = M
			R -= 1
		else:
			L = L // 2
			R = M
	while L * (k + 1) < n1 and n1 - L * (k + 1) >= k:
		L += 1
	if n - L * (k + 1) <= n1 and n1 != (n + 1) // 2 or (n - L * (k + 1) < n1 and n1 == (n + 1) // 2):
		L -= 1
	print(L, L * k, n - L * (k + 1))


z = input
(a, b) = list(map(int, z().split()))
d = a // 2 // (b + 1)
print(d, d * b, a - d - d * b)


(n, k) = [int(x) for x in input().split(' ')]
a = n // (2 * (1 + k))
b = a * k
c = n - (a + b)
print('%d %d %d' % (a, b, c))


import math
(n, k) = map(int, input().split())
a = math.floor(math.floor(n / 2) / (k + 1))
b = a * k
rest = n - a - b
print(a, b, rest)


(n, k) = [int(i) for i in input().split(' ')]
s = n // 2 // (k + 1)
print(s, k * s, n - (k + 1) * s)


(n, k) = map(int, input().split())
x = n // 2
if x < k + 1:
	print(0, 0, n)
else:
	while x >= k + 1 and x % (k + 1) != 0:
		x -= x % (k + 1)
	if x % (k + 1) == 0:
		y = x // (k + 1)
		l = n - x
		print(y, k * y, l)
	else:
		print(0, 0, n)


(n, k) = map(int, input().split())
d = 0
g = 0
nul = n
l = 0
r = n
while r - l != 1:
	x = (l + r) // 2
	if x + x // k <= n // 2:
		if x % k == 0:
			d = x // k
			g = d * k
			nul = n - d - g
		l = x
	else:
		r = x
d = l // k
g = d * k
nul = n - d - g
print(d, g, nul)


n = list(map(int, input().split()))
s = n[0] // 2
z = s // (n[1] + 1)
m = z * n[1]
if n[0] % 2 == 0:
	print(z, m, s + (s - (m + z)))
else:
	print(z, m, s + 1 + (s - (m + z)))


string = input()
numbers = string.split(' ')
a = int(numbers[0])
b = int(numbers[1])
x = a // 2 // (b + 1)
y = b * x
z = a - x - y
print('%d %d %d' % (x, y, z))


(n, k) = map(int, input().split())
l = -1
h = n + 1
while l + 1 < h:
	mid = (l + h) // 2
	if 2 * (mid + k * mid) <= n:
		l = mid
	else:
		h = mid
print(l, k * l, n - (l + k * l))


(n, k) = [int(item) for item in input().split()]
u = n // 2
print(u // (k + 1), u // (k + 1) * k, n - u // (k + 1) - u // (k + 1) * k)


(n, k) = (int(x) for x in input().split())
l = 1
r = n // (k + 1)
ans = 0
while l <= r:
	mid = (l + r) // 2
	if (k + 1) * mid <= n // 2:
		l = mid + 1
		ans = mid
	else:
		r = mid - 1
print(ans, ans * k, n - (k + 1) * ans)


(n, k) = (int(i) for i in input().split())
t = int(n / 2 // (k + 1))
print(t, t * k, n - t * (k + 1))


(n, k) = map(int, input().split())
h = n // 2
d = h // (k + 1)
c = d * k
r = n - (d + c)
print(d, c, r)


(n, k) = map(int, input().split())
d = n // (2 * (k + 1))
g = k * d
r = n - d - g
print(str(d) + ' ' + str(g) + ' ' + str(r))


(n, k) = map(int, input().split())
d = n // 2 // (k + 1)
c = k * d
l = n - c - d
print(str(d) + ' ' + str(c) + ' ' + str(l))


(n, k) = list(map(int, input().strip().split(' ')))
d = n // (2 * (k + 1))
c = k * d
w = 0
if d + c >= n / 2:
	w = n // 2
else:
	w = c + d
print(d, c, n - w)


(n, k) = list(map(int, input().split()))
no_of_nonWinners = n // 2
no_of_diplomas = no_of_nonWinners // (k + 1)
no_of_certificates = k * no_of_diplomas
no_of_nonWinners = n - (no_of_certificates + no_of_diplomas)
print(no_of_diplomas, end=' ')
print(no_of_certificates, end=' ')
print(no_of_nonWinners, end=' ')


(n, k) = input().strip().split()
(n, k) = (int(n), int(k))
x = n // (2 * (k + 1))
if x < 1:
	print(0, ' ', 0, ' ', n)
else:
	print(x, ' ', k * x, ' ', n - x - k * x)


s = input().split()
(n, k) = (int(s[0]), int(s[1]))
d = int(n // 2 / (k + 1))
c = k * d
nw = n - (c + d)
print(d, c, nw)


(n, k) = map(int, input().split())
x = n // (2 * (k + 1))
print(x, x * k, n - x * (k + 1))


import sys, string, bisect
input = sys.stdin.readline
import random
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
(n, k) = M()
p = n // 2
w = p // (k + 1)
a = w
b = w * k
print(a, b, n - (a + b))


(n, k) = map(int, input().split())
d = n // 2 // (k + 1)
g = k * d
print(d, g, n - d - g)


def solution(n, k):
	p = n // 2 // (k + 1)
	return (p, k * p, n - p - k * p)
(n, k) = map(int, input().split())
print(*solution(n, k))


(n, k) = map(int, input().split())
ans1 = n // (k + 1) * (k + 1) // ((k + 1) * 2)
ans2 = n // (k + 1) * (k + 1) // ((k + 1) * 2) * k
ans3 = n - ans1 - ans2
print(ans1, ans2, ans3)


(n, k) = map(int, input().split())
d = int(n / 2 / (k + 1))
s = d * k
kazanamayan = n - (s + d)
print(d, s, kazanamayan, sep=' ')


(N, K) = map(int, input().split())
D = int(N / (2 * (K + 1)))
print(D, end=' ')
print(D * K, end=' ')
print(max(N // 2, N - D * (K + 1)))


(n, k) = [int(i) for i in input().split()]
l = 0
r = 10 ** 13
while l < r:
	cur = (l + r + 1) // 2
	priz = cur * k
	if cur + priz <= n // 2:
		l = cur
	else:
		r = cur - 1
print(l, l * k, n - l - l * k)


from math import *
(n, k) = map(int, input().split())
print(n // (2 * (k + 1)), n // (2 * (k + 1)) * k, n - n // (2 * (k + 1)) * (k + 1))


(n, k) = map(int, input().split())

def f(x):
	return (k + 1) * x <= n // 2
(left, right) = (0, n // k)
(l, r) = (left, right)
while l < r:
	m = (l + r) // 2
	if f(m):
		l = m
	else:
		r = min(m - 1, right)
	if l == r - 1:
		if f(r):
			l = r
		else:
			r = l
print(r)
print(k * r)
print(n - (k + 1) * r)


(n, k) = map(int, input().split())
dips = n // 2 // (k + 1)
print(dips, dips * k, n - (1 + k) * dips)


import math
N = list(map(int, input().split()))
n = N[0]
k = N[1]
d = math.floor(n / (2 * (k + 1)))
c = k * d
w = n - c - d
print(d, c, w, end=' ')


cnt = lambda s, i: s.count(i)
ii = lambda : int(input())
si = lambda : input()
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
(n, k) = f()
i = n // 2 // (k + 1)
print(i, i * k, n - (i + i * k))


(n, k) = map(int, input().split())
(l, r) = (0, n // 2)
while l < r:
	d = (l + r + 1) // 2
	if 2 * d * (1 + k) <= n:
		l = d
	else:
		r = d - 1
print(l, k * l, n - (l + k * l))


(n, k) = map(int, input().split())
m = n // 2 / (k + 1)
print(int(m), k * int(m), n - (k + 1) * int(m))


temp = input().split()
n = int(temp[0])
k = int(temp[1])
winner = n // 2
diplo = winner // (1 + k)
certi = diplo * k
notWinner = n - (diplo + certi)
print(diplo, certi, notWinner)


linha = input().split(' ')
alunos = int(linha[0])
ratio = int(linha[1])
losers = alunos
if ratio > alunos / 2:
	print(0, 0, alunos)
else:
	a = int(alunos / 2 / (ratio + 1))
	b = a * ratio
	c = alunos / 2 % (ratio + 1)
	losers = alunos - (a + b)
	print('%i %i %i' % (a, b, losers))


def read():
	return [int(x) for x in input().split(' ')]
(n, k) = read()
proportion = n // 2 // (k + 1)
d = proportion
c = proportion * k
print('{} {} {}'.format(d, c, n - (c + d)))


[n, k] = [int(i) for i in input().split()]
half = n // 2
correction = half % (k + 1)
winners = half - correction
diplomas = winners // (k + 1)
print(diplomas, winners - diplomas, n - winners)


(n, k) = map(int, input().split())
(lo, hi, ans) = (1, n, 0)
while lo <= hi:
	mid = (lo + hi) // 2
	if mid * (k + 1) * 2 <= n:
		ans = mid
		lo = mid + 1
	else:
		hi = mid - 1
print('%d %d %d' % (ans, ans * k, n - ans * (k + 1)))


def __starting_point():
	(n, k) = list(map(int, input().split()))
	c = n // ((k + 1) * 2)
	if c == 0:
		print(0, 0, n)
	else:
		print(c, k * c, n - (k + 1) * c)
__starting_point()


(n, k) = map(int, input().strip(' ').split(' '))
diplomas = n // (2 * (k + 1))
winners = diplomas + k * diplomas
if diplomas < 1:
	print(0, 0, n)
elif winners > n / 2:
	while winners > n / 2 and diplomas > 0:
		diplomas -= 1
		winners = diplomas + k * diplomas
	print(diplomas, k * diplomas, n - winners)
else:
	print(diplomas, k * diplomas, n - winners)


import math
import time
st = input().split()
n = int(st[0])
k = int(st[1])
a = n // (2 * k + 2)
if a != 0:
	b = k * a
	c = n - a - b
else:
	b = 0
	c = n
print(a, b, c)


(a, b) = map(int, input().split())
c = a // 2
d = c // (b + 1)
print(d, b * d, a - d - b * d)


import sys

def main():
	(n, k) = map(int, sys.stdin.read().strip().split())
	t = n // 2 // (k + 1)
	return (t, t * k, n - t * (k + 1))
print(*main())


(n, k) = map(int, input().split())
diplomas = n // (2 * (k + 1))
certs = diplomas * k
print(diplomas, certs, n - diplomas - certs)


(n, k) = [int(x) for x in input().split()]
d = n // (2 * (k + 1))
print(d, k * d, n - (k + 1) * d)


(n, k) = [int(s) for s in input().split(' ')]
d = n // 2 // (k + 1)
print(d, k * d, n - (k + 1) * d)


(n, k) = [int(i) for i in input().split()]
a = n // 2 // (k + 1)
print(a, a * k, n - a * (k + 1))


(n, k) = map(int, input().split())
ans = n // (k + 1)
if (k + 1) * ans > n // 2:
	ans = n // 2 // (k + 1)
print(ans, k * ans, n - (k + 1) * ans)


(n, k) = map(int, input().split())
if n / 2 < k + 1:
	print(0, 0, n)
else:
	a = n // 2 // (k + 1)
	print(a, a * k, n - a * (k + 1))


[n, k] = map(int, input().split())
d = int(n / (2 * (k + 1)))
print('{0:d} {1:d} {2:d}'.format(d, d * k, n - d - d * k))


(n, k) = list(map(int, input().split()))
a = n // (2 * (k + 1))
b = k * a
c = n - a - b
print(a, b, c)


(s, r) = list(map(int, input().split()))
if s > r:
	temp = s // 2
	dip = temp // (r + 1)
	cert = r * dip
	print('{} {} {}'.format(dip, cert, s - dip - cert))
else:
	print('{} {} {}'.format('0', '0', s))


(n, k) = map(int, input().split())
d = 0
lo = 0
hi = n // 2
while hi - lo > 1:
	mid = lo + hi >> 1
	if mid * (k + 1) <= n // 2:
		lo = mid
	else:
		hi = mid
if hi * (k + 1) <= n // 2:
	d = hi
else:
	d = lo
c = d * k
rest = n - d - c
print(str(d) + ' ' + str(c) + ' ' + str(rest))


(n, k) = [int(i) for i in input().split()]
m = n // 2 // (k + 1)
print(m, k * m, n - (k + 1) * m)


import sys
input = sys.stdin.readline
(n, k) = list(map(int, input().split()))
factor = n // 2 // (k + 1)
print('%d %d %d' % (factor, factor * k, n - factor * (k + 1)))


(n, k) = [int(i) for i in input().split()]
d = 0
g = 0
ost = 0
ost = n // 2
if ost >= 1 + k:
	d = int(ost / (1 + k))
	g = int(d * k)
	ost = n - (d + g)
else:
	ost = n
print(d, g, ost)


import math
(n, k) = map(int, input().split())
z = math.ceil(n / 2)
n -= z
a = n // (k + 1)
b = n // (k + 1) * k
print(a, b, z + n - a - b)


(n, k) = input().split()
(n, k) = (int(n), int(k))
dip = gram = 0
dip = int(n / 2 / (k + 1))
gram = int(dip * k)
if dip + gram > n / 2:
	print(0, 0, n, end=' ')
else:
	other = n - dip - gram
	print(int(dip), int(gram), int(other), end=' ')


(N, k) = [int(i) for i in input().split()]
g = N // 2 // (k + 1)
print(g, g * k, N - g * (k + 1))


get = lambda : list(map(int, input().split()))
(n, k) = get()
a = n // 2
b = a // (k + 1)
ans = [b * k, b]
print(ans[1], ans[0], n - b * (k + 1))


(n, k) = map(int, input().split())
max_winners = n // 2
certificates = max_winners // (k + 1)
diplomas = certificates * k
not_winners = n - (certificates + diplomas)
print(certificates, diplomas, not_winners)


(a, b) = map(int, input().split())
t = a // 2
print(t // (b + 1), b * (t // (b + 1)), a - t // (b + 1) - b * (t // (b + 1)))


(a, b) = map(int, input().split())
x = a // 2
if x < b + 1:
	print(0, 0, a)
else:
	while x >= b + 1 and x % (b + 1) != 0:
		x -= x % (b + 1)
	if x % (b + 1) == 0:
		y = x // (b + 1)
		s = a - x
		print(y, b * y, s)
	else:
		print(0, 0, a)


(n, k) = map(int, input().split())
diploma = n // 2 // (k + 1)
gram = diploma * k
s = n - gram - diploma
print(diploma, gram, s)


str = input()
(n, k) = str.split(' ')
n = int(n)
k = int(k)
a = n // 2 // (k + 1)
b = a * k
c = n - a - b
print(a, b, c)


line = input().split(' ')
n = int(line[0])
k = int(line[1])
mitad = n / 2
if k >= mitad:
	dipl = 0
	cert = 0
else:
	dipl = int(mitad) // (1 + k)
	cert = dipl * k
print(str(dipl) + ' ' + str(cert) + ' ' + str(n - dipl - cert))


(n, k) = map(int, input().split(' '))
print('%d %d %d' % (n // (2 * k + 2), n // (2 * k + 2) * k, n - (n // (2 * k + 2) + n // (2 * k + 2) * k)))


def read():
	return [int(x) for x in input().split()]
(x, y) = read()
i = 0
z = x // 2
a = 0
while z > 0:
	if i % (y + 1) == 0:
		a = int(z / (y + 1))
		break
	z -= 1
print(str(a) + ' ' + str(a * y) + ' ' + str(x - a * (y + 1)))


[n, k] = [int(_) for _ in input().split()]
[l, r] = [0, n]
while l + 1 < r:
	m = (l + r) // 2
	p = m + m * k
	if p <= n // 2:
		l = m
	else:
		r = m
print(l, l * k, n - l * k - l)


(n, k) = [int(i) for i in input().split()]
d = n // (2 * (k + 1))
c = d * k
l = n - (d + c)
print(d, c, l)


inp = input().split()
n = int(inp[0])
k = int(inp[1])
print(int(n / (2 * (k + 1))), k * int(n / (2 * (k + 1))), n - (k + 1) * int(n / (2 * (k + 1))))


def main():
	(n, k) = map(int, input().split())
	we = n // (2 * (k + 1))
	ans = n - (k + 1) * we
	print(we, end=' ')
	print(we * k, end=' ')
	print(ans)
main()


(n, k) = list(map(int, input().split()))
d = int(n / (2 * (k + 1)))
print(d, k * d, n - (k + 1) * d)


(n, k) = map(int, input().split())
l = -1
r = n
while r - l > 1:
	m = (l + r) // 2
	if m + m * k > n // 2:
		r = m
	else:
		l = m
print(l, l * k, n - l - l * k)


(n, k) = (int(a) for a in input('').split())
a = int(n / 2)
if a % (k + 1) != 0:
	a = a - a % (k + 1)
x = int(a / (k + 1))
y = int(x * k)
z = int(n - (x + y))
print(x, y, z)


(num_students, k) = list(map(int, input().strip().split()))
half = num_students // 2
first = 0
second = 0
while half:
	tot = half // (k + 1)
	first = tot
	second = tot * k
	if first + second <= num_students // 2:
		break
	half -= 1
if first == 0:
	print(first, second, num_students)
else:
	print(first, second, num_students - (first + second))


inp = input().split()
n = int(inp[0])
k = int(inp[1])
hn = int(n / 2)
res = int(hn / (k + 1))
if res == 0:
	print('0 0 ' + str(n))
else:
	print(str(res) + ' ' + str(k * res) + ' ' + str(n - (k + 1) * res))


def main():
	(n, k) = map(int, input().split())
	x = n // 2 // (k + 1)
	print(x, x * k, n - x * (k + 1))
main()


(n, k) = [int(x) for x in input().split()]

def check(n, dip, k):
	return n - (dip + k * dip) >= n / 2
(l, r) = (0, 1000000000000000000000000000)
while l + 1 != r:
	m = (l + r) // 2
	if check(n, m, k):
		l = m
	else:
		r = m
print(l, l * k, n - (l + l * k))


(n, k) = map(int, input().split())
win = n // 2
win = win - win % (k + 1)
print(win // (k + 1), win * k // (k + 1), n - win)


(n, k) = map(int, input().split())
p = n // 2 // (k + 1) * (k + 1)
a = p / (k + 1)
b = k * p / (k + 1)
print(int(a), int(b), int(n - a - b))


(n, k) = map(int, input().split())
l = n // (2 * (k + 1))
print(l, l * k, n - l * (k + 1))


(n, k) = map(int, input().split())
no_dip = 1 / 2 * n // (k + 1)
no_certi = no_dip * k
no_winners = no_dip + no_certi
if no_winners > 1 / 2 * n:
	no_winners = 1 / 2 * n
print(int(no_dip), int(no_certi), int(n - no_winners))


from math import floor
(n, k) = list(map(int, input().split()))
r = floor(n / (2 * (k + 1)))
print(r, k * r, n - r * (k + 1))


l = input()
(n, k) = l.split(' ')
n = int(n)
k = int(k)
winmax = n / 2
nd = winmax / (k + 1)
nd = int(nd)
print(str(nd) + ' ' + str(k * nd) + ' ' + str(n - (k + 1) * nd))


(n, k) = [int(i) for i in input().split()]
ans = []
d = n // 2 // (k + 1)
g = d * k
noth = n - d - g
print(d, g, noth)


line_input = list(map(int, input().split()))
num_students = line_input[0]
ratio = line_input[1]
max_winners = int(num_students / 2)
diplomas = int(max_winners / (ratio + 1))
certificates = diplomas * ratio
losers = num_students - diplomas - certificates
print('%d %d %d' % (diplomas, certificates, losers))


(n, k) = input().split()
n = int(n)
k = int(k)
esq = 0
dir = 1000000000000.0
res = 0
while esq <= dir:
	mid = (esq + dir) // 2
	D = mid
	C = mid * k
	if 2 * C + 2 * D <= n:
		esq = mid + 1
		res = max(res, D)
	else:
		dir = mid - 1
print(str(int(res)) + ' ' + str(int(res * k)) + ' ' + str(int(n - res - res * k)))


import os
import sys
from io import BytesIO, IOBase
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		self._fd = file.fileno()
		self.buffer = BytesIO()
		self.writable = 'x' in file.mode or 'r' not in file.mode
		self.write = self.buffer.write if self.writable else None

	def read(self):
		while True:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			if not b:
				break
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines = 0
		return self.buffer.read()

	def readline(self):
		while self.newlines == 0:
			b = os.read(self._fd, max(os.fstat(self._fd).st_size, BUFSIZE))
			self.newlines = b.count(b'\n') + (not b)
			ptr = self.buffer.tell()
			(self.buffer.seek(0, 2), self.buffer.write(b), self.buffer.seek(ptr))
		self.newlines -= 1
		return self.buffer.readline()

	def flush(self):
		if self.writable:
			os.write(self._fd, self.buffer.getvalue())
			(self.buffer.truncate(0), self.buffer.seek(0))

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')
(n, k) = map(int, input().split())
r = n // 2 // (k + 1)
print(r, r * k, n - r * (k + 1))


def main():
	(n, k) = map(int, input().split())
	x = n // ((k + 1) * 2) - 1
	if x < 0:
		x = 0
	y = x + 1
	if (1 + k) * y <= n / 2:
		print(str(y) + ' ' + str(k * y) + ' ' + str(n - (1 + k) * y))
		return
	if (1 + k) * x <= n / 2:
		print(str(x) + ' ' + str(k * x) + ' ' + str(n - (1 + k) * x))
	else:
		print('0 0 ' + str(n))
main()


from math import *
(n, k) = map(int, input().split())
if k >= n:
	l = n
	d = 0
	c = 0
else:
	w = floor(n / 2)
	l = n - w
	d = w // (k + 1)
	c = d * k
	l += n - l - d - c
print(d, c, l)


class CodeforcesTask818ASolution:

	def __init__(self):
		self.result = ''
		self.n_k = []

	def read_input(self):
		self.n_k = [int(x) for x in input().split(' ')]

	def process_task(self):
		r = self.n_k[1] + 1
		x = self.n_k[0] // 2 // r
		self.result = '{1} {2} {0}'.format(self.n_k[0] - r * x, x, x * self.n_k[1])

	def get_result(self):
		return self.result
Solution = CodeforcesTask818ASolution()
Solution.read_input()
Solution.process_task()
print(Solution.get_result())


import math as math
input_ar = list(map(int, input().rstrip().split(' ')))
n = input_ar[0]
k = input_ar[1]
winner_max = n // 2
max_diplomas = winner_max / (k + 1)
int_dip = int(math.floor(max_diplomas))
if max_diplomas == int_dip:
	print('{} {} {}'.format(int_dip, winner_max - int_dip, n - winner_max))
else:
	print('{} {} {}'.format(int_dip, k * int_dip, n - (k + 1) * int_dip))


(n, k) = map(int, input().split())
p = n // 2
d = p // (k + 1)
g = d * k
z = n - d - g
print(str(d) + ' ' + str(g) + ' ' + str(z))


(n, k) = input().split()
n = int(n)
k = int(k)
dip = n // (2 * (k + 1))
cert = dip * k
total = dip + cert
print(str(dip) + ' ' + str(cert) + ' ' + str(n - total))


(n, k) = map(int, input().split())
w = n // 2
c = k + 1
d = w // c
cert = d * k
print(d, cert, n - (d + cert), end=' ')


(n, k) = map(int, input().split())
nd = n // 2 // (k + 1)
nc = k * nd
nl = n - nc - nd
print(nd, nc, nl)


def check(n, k, cnt):
	if 2 * cnt * (k + 1) <= n:
		return True
	else:
		return False
(n, k) = map(int, input().split())
l = 0
r = 100000000000000
while r - l > 1:
	m = (l + r) // 2
	if check(n, k, m) == True:
		l = m
	else:
		r = m
print(l, l * k, n - l * (k + 1))


X = list(map(int, input().split()))
if X[1] > X[0] // 2:
	print(0, 0, X[0])
	exit()
MAX = X[0] // 2
MAX = MAX - MAX % (X[1] + 1)
x = MAX // (X[1] + 1)
print(x, x * X[1], X[0] - MAX)


def list_input():
	return list(map(int, input().split()))
[n, k] = list_input()
d = n // (2 * (k + 1))
c = k * d
l = n - (c + d)
print(' '.join(map(str, [d, c, l])))


import math
import itertools
import collections

def getdict(n):
	d = {}
	if type(n) is list:
		for i in n:
			if i in d:
				d[i] += 1
			else:
				d[i] = 1
	else:
		for i in range(n):
			t = ii()
			if t in d:
				d[t] += 1
			else:
				d[t] = 1
	return d

def cdiv(n, k):
	return n // k + (n % k != 0)

def ii():
	return int(input())

def mi():
	return map(int, input().split())

def li():
	return list(map(int, input().split()))

def lcm(a, b):
	return abs(a * b) // math.gcd(a, b)

def wr(arr):
	return ' '.join(map(str, arr))

def prime(n):
	if n == 2:
		return True
	if n % 2 == 0 or n <= 1:
		return False
	sqr = int(math.sqrt(n)) + 1
	for d in range(3, sqr, 2):
		if n % d == 0:
			return False
	return True

def revn(n):
	m = 0
	while n > 0:
		m = m * 10 + n % 10
		n = n // 10
	return m
(n, k) = mi()
if k + 1 > n // 2:
	print(0, 0, n)
else:
	d = n // 2 // (k + 1)
	print(d, d * k, n - (k + 1) * d)


(n, k) = map(int, input().split())
half = n // 2
x = half // (k + 1)
non_winners = n - x - x * k
print(x, x * k, non_winners)


import sys
for line in sys.stdin:
	(n, k) = map(int, line.split())
	d = n // (2 * (k + 1))
	c = k * d
	print(d, c, n - c - d)


(n, k) = input().split(' ')
n = int(n)
k = int(k)
print(int(n // 2 // (k + 1)), k * int(n // 2 // (k + 1)), n - (k + 1) * int(n // 2 // (k + 1)))


import math
(n, k) = map(int, input().split())
total = n
none = math.ceil(n / 2)
n -= none
index = n // (k + 1)
a = index
b = index * k
none += n - (a + b)
print(a, b, none)


(n, k) = map(int, input().split(' '))
maxwin = n // 2
if maxwin % (k + 1) != 0:
	maxwin = maxwin // (k + 1) * (k + 1)
left = n - maxwin
maxdip = maxwin // (k + 1)
maxcer = maxwin // (k + 1) * k
print(maxdip, maxcer, left)


(n, k) = [int(number) for number in input().split()]
x = n // 2
a = x // (k + 1)
print(a, a * k, n - a - a * k)


(n, k) = map(int, input().split())
nwi = (n + 1) // 2
wi = n // 2
nwi = nwi + wi % (k + 1)
wi = wi // (k + 1) * (k + 1)
dip = wi // (k + 1)
cert = wi - dip
print(dip, cert, nwi)


(n, k) = (int(i) for i in input().split())
x = int((n - n / 2) / (1 + k))
print(x, x * k, n - x - x * k)


(a, b) = input().split()
a = int(a)
b = int(b)
if b >= a // 2:
	print('0 0', a)
else:
	i = a // (2 * (b + 1))
	print(i, i * b, a - i * (b + 1))


(n, k) = map(int, input().split())
from math import floor
priz = floor(n / 2)
pob = floor(priz / (k + 1))
priz = pob * k
print(pob, ' ', priz, ' ', n - pob - priz)


(n, k) = map(int, input().split())
t = n
n //= 2
ans = 0
l = 0
r = n
while r - l > 1:
	mid = (r + l) // 2
	if mid + mid * k <= n:
		l = mid
	else:
		r = mid
for i in range(r, l - 1, -1):
	if i + i * k <= n:
		print(i, i * k, t - i - i * k)


s = input()
l = s.split()
n = int(l[0])
k = int(l[1])
a = n // 2
p1 = a // (k + 1)
p2 = k * p1
p3 = n - p2 - p1
if p3 >= n / 2:
	print(int(p1), int(p2), int(p3))
else:
	print(0, 0, n)


(n, k) = map(int, input().split())
l = 0
r = 10 ** 12 + 1
while l < r - 1:
	m = (l + r) // 2
	if m + m * k <= n // 2:
		l = m
	else:
		r = m
print(l, l * k, n - l * (k + 1))


nk = input().split()
n = int(nk[0])
k = int(nk[1])
t = n // 2
t -= t % (k + 1)
d = t * k // (k + 1)
g = t // (k + 1)
o = n - d - g
print(g, d, o)


import math
(students, ratio) = input().split()
(students, ratio) = (int(students), int(ratio))
dip = math.floor(students / 2 / (ratio + 1))
win = dip * ratio
print(dip, win, students - dip - win)


from math import floor

def main():
	[n, k] = [int(_) for _ in input().split()]
	diplomas = floor(n // 2 / (k + 1))
	certificates = k * diplomas
	non_winners = n - diplomas - certificates
	print(diplomas, certificates, non_winners)
main()


(n, k) = map(int, input().split())
l = -1
r = int(10000000000000.0)

def check(x):
	return x * (k + 1) >= n // 2
while r - l > 1:
	mid = (l + r) // 2
	if check(mid):
		r = mid
	else:
		l = mid
if r * (k + 1) > n // 2:
	r = l
print(r, r * k, n - r * (k + 1))


import math
import time
import random
start = time.time()
(n, k) = list(map(int, input().split()))
certi = n // (2 * (k + 1))
diploma = k * certi
rem = n - certi - diploma
print(certi, diploma, rem)
end = time.time()


(n, k) = [int(i) for i in input().split()]
max_wins = n // 2
diplo = max_wins // (k + 1)
certi = diplo * k
print(diplo, certi, n - diplo - certi)


(n, k) = input().split()
(n, k) = (int(n), int(k))
(lo, hi) = (0, n // (k + 1))
while lo < hi:
	mid = (lo + hi + 1) // 2
	if mid * (k + 1) > n // 2:
		hi = mid - 1
	else:
		lo = mid
print(lo, lo * k, n - lo * (k + 1))


(n, k) = map(int, input().split())
p = n // 2 // (k + 1)
g = p * k
o = n - p - g
print(p, g, o)


numList = input().split(' ')
n = int(numList[0])
k = int(numList[1])
d = n // 2 // (k + 1)
c = k * d
other = n - c - d
print(d, c, other)


(a, b) = map(int, input().split())
z = a // 2
x = z // (b + 1)
print(x, b * x, a - (b + 1) * x)


(n, k) = map(int, input().split())
c = n // ((k + 1) * 2)
print(c, end=' ')
d = k * c
print(d, end=' ')
re = n - (c + d)
print(re)


Input = lambda : map(int, input().split())
(s, k) = Input()
if k + 1 > s // 2:
	print(0, 0, s)
	exit()
i = s // 2
if i % (k + 1) == 0:
	d = i // (k + 1)
	n = s - i
else:
	y = i // (k + 1)
	i = y * (k + 1)
	d = i // (k + 1)
	n = s - i
c = s - d - n
print(d, c, n)


(n, k) = [int(x) for x in input().split()]
x = n // (2 * (k + 1))
print(str(x) + ' ' + str(k * x) + ' ' + str(n - (k + 1) * x))


(n, k) = map(int, input().split())
a = n // 2
while a / (k + 1) != int(a / (k + 1)):
	j = a % (k + 1)
	a -= j
b = a // (k + 1)
print(b, k * b, n - (k + 1) * b)


(n, k) = map(int, input().split())
prize = n // 2
prize -= prize % (k + 1)
dipl = prize // (k + 1)
rest = dipl * k
print(dipl, rest, n - prize)


data = input().split()
n = int(data[0])
k = int(data[1])
d = int(n / (2 * (1 + k)))
c = int(k * d)
w = int(n - (c + d))
print(d, c, w)


import math
(n, k) = map(int, input().split())
x = int(math.floor(n / 2) / (k + 1))
if x < 0:
	print(0, 0, n)
else:
	cert = x * k
	print(x, cert, n - x - cert)


(n, k) = map(int, input().split())
if k + 1 > n // 2:
	p = 0
	q = 0
	r = n
	print(p, q, r)
	exit()
x = n // (2 * (k + 1))
y = k * x
print(x, y, n - x - y)


s = input().split()
n = int(s[0])
k = int(s[1])
a = n // (2 * (k + 1))
b = k * a
print(a, ' ', b, ' ', n - (a + b))


(n, k) = map(int, input().split())
l = 0
r = n // 2 + 1
while 1 < r - l:
	c = (l + r) // 2
	if c * (k + 1) <= n // 2:
		l = c
	else:
		r = c
ans = [l, l * k, n - l - l * k]
print(' '.join(list(map(str, ans))))


import math
(z, k) = map(int, input().split())
tmp = z
z //= 2
x = int(z / (k + 1))
y = int(x * k)
print(x, y, tmp - x - y)


(n, k) = map(int, input().split())
dip = n // 2 // (k + 1)
print(dip, dip * k, n - dip - dip * k)


(n, k) = map(int, input().split())
h = n // 2
h -= h % (k + 1)
print(h // (k + 1), h // (k + 1) * k, n - h)


(n, k) = map(int, input().split())
h = n // 2
a = h // (k + 1)
print(a, k * a, n - a * (k + 1), end=' ')


import math
ip = input()
I = ip.split()
n = int(I[0])
k = int(I[1])
max_wins = n // 2
dipls = math.floor(max_wins / (k + 1))
certs = dipls * k
non_winners = n - (certs + dipls)
print(str(dipls) + ' ' + str(certs) + ' ' + str(non_winners))


(n, k) = list(map(int, input().split()))
r = n // (k + 1 << 1)
print(r, r * k, n - r * (k + 1))


from math import floor, ceil
(n, k) = map(int, input().split())
i = floor(0.5 * n / (k + 1))
print(i, i * k, n - i * (k + 1))


(n, k) = list(map(int, input().strip().split()))
d = n // 2 // (k + 1)
print(str(d) + ' ' + str(d * k) + ' ' + str(n - d * (k + 1)))


from math import *
st = input()
s = st.split(' ')
s1 = [0, 0]
s1[0] = int(s[0])
s1[1] = int(s[1])
n = s1[0]
k = s1[1]
half = n // 2
x = half / (k + 1)
print(floor(x))
print(k * floor(x))
print(n - (k + 1) * floor(x))


(n, k) = [int(t) for t in input().split()]
dip = n // 2 // (k + 1)
gr = k * dip
lost = n - dip - gr
print(dip, gr, lost)


a = input()
m = a.split()
n = int(m[0])
k = int(m[1])
pol = n // 2
pob = pol // (k + 1)
print(pob, ' ', k * pob, ' ', n - (k + 1) * pob)


(n, k) = map(int, input().split())
certificate = n // 2 // (k + 1) * k
diplomas = n // 2 // (k + 1)
non_winners = n - diplomas - certificate
print(diplomas, certificate, non_winners)


def diploma():
	IPT = []
	ipt = input()
	Ipt = ipt.split()
	for x in Ipt:
		IPT.append(int(x))
	n = IPT[0]
	k = IPT[1]
	C = 0
	D = 0
	R = int(n / 2)
	C = int(R / (k + 1))
	D = C * k
	print(str(int(C)) + ' ' + str(int(D)) + ' ' + str(int(n - C - D)))
diploma()


(n, k) = map(int, input().split())
n2 = n // 2 + n % 2
i = 1
if k >= n:
	print(0, 0, n)
else:
	(win, cer) = (n // 2 // (k + 1), n // 2 // (k + 1) * k)
	print(win, cer, n - win - cer)


x = input().split()
n = int(x[0])
k = int(x[1])
n1 = n // 2
if n1 <= k:
	print(0, 0, n)
else:
	d = n1 // (k + 1)
	d1 = d * (k + 1)
	c = d1 - d
	n2 = n - d1
	print(d, c, n2)


import math, itertools, fractions, heapq, collections, bisect, sys, queue, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

def LI():
	return [int(x) for x in sys.stdin.readline().split()]

def I():
	return int(sys.stdin.readline())

def F():
	return float(sys.stdin.readline())

def LS():
	return sys.stdin.readline().split()

def S():
	return input()

def main():
	(n, k) = LI()
	a = b = 0
	c = n
	a = 1
	b = a * k
	x = a + b
	y = n // 2 // x
	return str(y) + ' ' + str(y * k) + ' ' + str(n - (y + y * k))
print(main())


(n, k) = map(int, input().split())
l = 0
r = 10 ** 12 + 1
while r - l > 1:
	d = (r + l) // 2
	if n // (d * k + d) >= 2:
		l = d
	else:
		r = d
d = l
g = d * k
sh = n - g - d
print(d, g, sh)


import sys
(n, k) = input().strip().split(' ')
(n, k) = [int(n), int(k)]
half = int(n / 2)
answer = int(half / (k + 1))
certificates = answer * k
not_winners = n - (answer + certificates)
print(str(answer) + ' ' + str(certificates) + ' ' + str(not_winners))


(a, k) = map(int, input().split())
c = int(a / 2 / (1 + k))
d = int(c * k)
e = a - c - d
print(c, ' ', d, ' ', e)


def dipCert(arr):
	(n, k) = (arr[0], arr[1])
	(d, c, l) = (0, 0, 0)
	if k > n // 2:
		(d, c, l) = (0, 0, n)
	else:
		c = n // 2 // (k + 1)
		d = c * k
		l = n - (c + d)
	ml = [c, d, l]
	return ml
ns = list(map(int, input().split()))
print(*dipCert(ns))


def f(m):
	global n, k
	if 2 * (m * k + m) <= n:
		return True
	else:
		return False
(n, k) = [int(x) for x in input().split()]
l = -1
r = n
while l + 1 != r:
	mid = (l + r) // 2
	if f(mid):
		l = mid
	else:
		r = mid
print(l, l * k, n - (l + l * k), sep=' ')


(n, k) = map(int, input().split())
priz = n // 2
res = priz // (k + 1)
print(res, end=' ')
print(res * k, end=' ')
print(n - (res + res * k))


(n, k) = map(int, input().split())
half = n // 2
d = 0
c = 0
u = n
i = half
while i >= 0:
	if i % (k + 1) == 0:
		d = i // (k + 1)
		c = i - d
		u = n - i
		break
	i -= i % (k + 1)
print(d, c, u)


def main():
	(n, k) = [int(x) for x in input().split()]
	d = max(0, n // (2 * k + 2))
	g = d * k
	print(d, g, n - (d + g))
main()


t = list(map(int, input().split()))
half = t[0] // 2
if t[1] > half:
	print(*[0, 0, t[0]])
elif t[1] <= half:
	s = half // (t[1] + 1)
	p = abs(half - s - t[1] * s)
	print(*[s, t[1] * s, t[0] - half + p])


(n, k) = map(int, input().split())
d = n // 2 // (k + 1)
ans = k * d
if ans >= 0 and d >= 0 and (ans + d <= n // 2):
	print(d, ans, n - ans - d)
else:
	print('0 0', n)


def winners(n, k):
	w = n // 2
	c = w // (k + 1)
	d = c * k
	nw = n - c - d
	return [c, d, nw]
(n, k) = list(map(int, input().strip().split()))
print(*winners(n, k))


from sys import stdin
max_val = int(10000000000000.0)
min_val = int(-10000000000000.0)

def read_int():
	return int(stdin.readline())

def read_ints():
	return [int(x) for x in stdin.readline().split()]

def read_str():
	return input()

def read_strs():
	return [x for x in stdin.readline().split()]
(nb_students, ratio) = read_ints()
diploma = nb_students // 2 // (ratio + 1)
certifi = diploma * ratio
nons = nb_students - diploma - certifi
print(diploma, certifi, nons)


(n, k) = map(int, input().split())
s = n // 2
p = s // (k + 1)
print(p, k * p, n - p - k * p)


(n, k) = list(map(int, input().split(' ')))
print((n // 2 - n // 2 % (k + 1)) // (k + 1), (n // 2 - n // 2 % (k + 1)) // (k + 1) * k, n - (n // 2 - n // 2 % (k + 1)) if k <= n // 2 else n)


import sys
(n, k) = map(int, input().split())
x = n // (2 * k + 2)
print(x, x * k, n - x * (k + 1))


def int_map():
	return list(map(int, input().split(' ')))
(n, k) = int_map()
q = n // 2
a = q // (k + 1)
print(a, k * a, n - (k + 1) * a)


(n, k) = map(int, input().split())
v_max = int(n / 2)
x_floor = int(v_max / (k + 1))
x = v_max / (k + 1)
if x_floor == x:
	aux = x_floor * (k + 1)
	aux = n - aux
	print(x_floor, x_floor * k, aux, sep=' ')
else:
	print(x_floor, x_floor * k, n - x_floor * (k + 1), sep=' ')


(n, k) = map(int, input().split())
f = int(n / 2)
f1 = int(f / (k + 1))
print(f1, f1 * k, n - f1 * (k + 1))


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
(n, k) = map(int, input().split())
d = n // (2 * k + 2)
c = d * k
r = n - c - d
print(d, c, r)


from sys import stdin, stdout
(n, k) = map(int, stdin.readline().split())
(l, r) = (0, n // 2)
while r - l > 1:
	m = (r + l) // 2
	if m * k + m > n / 2:
		r = m
	else:
		l = m
stdout.write(str(l) + ' ' + str(l * k) + ' ' + str(n - l * (k + 1)))


(n, k) = map(int, input().split())
m = n // 2
a = m // (k + 1)
b = a * k
print(a, b, n - (a + b))


(n, k) = map(int, input().split())
mw = n // 2
d = mw // (k + 1)
print(d, k * d, n - d * (1 + k))


(n, k) = map(int, input().split())
p_max = n // 2
nd = p_max // (k + 1)
ng = nd * k
print(nd, ng, n - ng - nd)


read = lambda : map(int, input().split())
(n, k) = read()
p = n // 2 // (k + 1)
print(p, p * k, n - p * (k + 1))


(n, k) = map(int, input().split())
p = n // 2 // (k + 1)
o = p * k
l = n - p - o
print(str(p) + ' ' + str(o) + ' ' + str(l))


(a, b) = map(int, input().split())
mult = a // 2 // (b + 1)
print(mult, mult * b, a - mult * (b + 1))


(n, k) = map(int, input().split())
num = int(n / 2 // (k + 1))
print(num, num * k, n - num * (k + 1))


import sys
arr = sys.stdin.readline().split()
arr_ = [int(elem) for elem in arr]
n = arr_[0]
k = arr_[1]
x = int(0.5 * (n / (k + 1)))
print(x, k * x, n - (k * x + x))


a = [int(x) for x in input().split()]
n = a[0]
k = a[1]
if k + 1 > int(n / 2):
	print(0, 0, n)
else:
	a = int(int(n / 2) / (1 + k))
	first = a
	second = a * k
	print(first, second, n - first - second)


import sys
(n, k) = map(int, input().split())
d = int(int(n / 2) / (k + 1))
c = k * d
if d >= 0 and c >= 0 and (c + d <= int(n / 2)):
	print(d, c, n - d - c)
else:
	print('0 0', n)


(n, k) = map(int, input().split())
z = n // 2
if n % 2 != 0:
	z += 1
n -= z
x = n // (k + 1)
if x == 0:
	print('0 0', n + z)
else:
	y = k * x
	print(x, y, n + z - x - y)


(n, k) = input().split()
n = eval(n)
k = eval(k)
d = n / (2 * (k + 1))
d = int(d)
c = k * d
o = n - d - c
print(d, ' ', c, ' ', o)


import string
import math

def selection_sort(l):
	for i in range(len(l)):
		min_val = l[i]
		min_val_index = i
		for j in range(i, len(l)):
			if l[j] < min_val:
				min_val = l[j]
				min_val_index = j
		(l[i], l[min_val_index]) = (l[min_val_index], l[i])
	return l

def merge_sort(l):

	def merge(l1, l2):
		output_list = []
		(i, j) = (0, 0)
		while i < len(l1) and j < len(l2):
			if l1[i] < l2[j]:
				output_list.append(l1[i])
				i += 1
			else:
				output_list.append(l2[j])
				j += 1
		if i == len(l1):
			output_list += l2[j:]
		else:
			output_list += l1[i:]
		return output_list

	def sort(li):
		if len(li) < 2:
			return li
		mid = len(li) // 2
		left = sort(li[:mid])
		right = sort(li[mid:])
		return merge(left, right)
	return sort(l)

def main_function():
	(n, k) = [int(i) for i in input().split(' ')]
	diplomas = n // 2 // (1 + k)
	certificates = diplomas * k
	winners = diplomas + certificates
	non_winners = n - winners
	if diplomas < 0:
		diplomas = 0
		certificates = 0
	return f'{diplomas} {certificates} {non_winners}'
print(main_function())


(n, k) = map(int, input().split())
winners = n // 2 // (k + 1)
print(winners, winners * k, n - winners * (k + 1))


(n, k) = map(int, input().split())
r1 = n // 2 // (k + 1)
r2 = k * r1
r3 = max(n - r1 - r2, (n + 1) // 2)
print(r1, r2, r3)


(n, k) = map(int, input().split())
mid = n // 2
u = mid // (k + 1)
print(str(u) + ' ' + str(k * u) + ' ' + str(n - (k + 1) * u))


(n, k) = map(int, input().split())
base = n // (2 * (k + 1))
print(base, k * base, n - (k + 1) * base)


def diplomas(n, k):
	return (n // 2 // (k + 1), n // 2 // (k + 1) * k, n - n // 2 // (k + 1) - n // 2 // (k + 1) * k)
(N, K) = [int(i) for i in input().split()]
print(*diplomas(N, K))


def read_tokens():
	return input().strip().split(' ')

def read_ints():
	return [int(s) for s in read_tokens()]
(n, k) = read_ints()

def solve(n, k):
	prizer = n // 2
	if prizer // k == 0:
		print(0, 0, n)
		return
	bad = 0
	good = max(n, k)
	while good - bad > 1:
		diploma = (good + bad) // 2
		if diploma * k + diploma >= prizer:
			good = diploma
		else:
			bad = diploma
	if good + good * k == prizer:
		print(good, good * k, n - good - good * k)
		return
	print(bad, bad * k, n - bad - bad * k)
solve(n, k)