You are given three integers $a \le b \le c$.

In one move, you can add $+1$ or $-1$ to any of these integers (i.e. increase or decrease any number by one). You can perform such operation any (possibly, zero) number of times, you can even perform this operation several times with one number. Note that you cannot make non-positive numbers using such operations.

You have to perform the minimum number of such operations in order to obtain three integers $A \le B \le C$ such that $B$ is divisible by $A$ and $C$ is divisible by $B$.

You have to answer $t$ independent test cases. 


-----Input-----

The first line of the input contains one integer $t$ ($1 \le t \le 100$) — the number of test cases.

The next $t$ lines describe test cases. Each test case is given on a separate line as three space-separated integers $a, b$ and $c$ ($1 \le a \le b \le c \le 10^4$).


-----Output-----

For each test case, print the answer. In the first line print $res$ — the minimum number of operations you have to perform to obtain three integers $A \le B \le C$ such that $B$ is divisible by $A$ and $C$ is divisible by $B$. On the second line print any suitable triple $A, B$ and $C$.


-----Example-----
Input
8
1 2 3
123 321 456
5 10 15
15 18 21
100 100 101
1 22 29
3 19 38
6 30 46

Output
1
1 1 3
102
114 228 456
4
4 8 16
6
18 18 18
1
100 100 100
7
1 22 22
2
1 19 38
8
6 24 48

Difficulty: EASY

Starter code:

Solutions:
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	min_move = float('inf')
	for a_cnt in range(1, 50000):
		for b_cnt in range(a_cnt, 50000, a_cnt):
			if c % b_cnt <= b_cnt - c % b_cnt:
				c_cnt = c - c % b_cnt
			else:
				c_cnt = c + b_cnt - c % b_cnt
			move = abs(a - a_cnt) + abs(b - b_cnt) + abs(c - c_cnt)
			if move < min_move:
				ans = [a_cnt, b_cnt, c_cnt]
				min_move = move
	print(min_move)
	print(*ans)


import math
import collections
import bisect
import heapq
import time
import random
import itertools
import sys
from typing import List

def sove(A, B, C):
	ans = A + B
	(xa, xb, xc) = (A, B, C)
	for a in range(1, C + 1):
		sa = abs(A - a)
		if sa >= ans:
			continue
		k = ans - sa
		(xl, xr) = (max(max(B - k, 1) // a, 1), (B + k) // a + 1)
		for dx in range(xl, xr + 1):
			b = dx * a
			sb = sa + abs(b - B)
			if sb >= ans:
				continue
			k = ans - sb
			(yl, yr) = (max(max(C - k, 1) // b, 1), (C + k) // b + 1)
			for dy in range(yl, yr + 1):
				c = dy * b
				sc = sb + abs(c - C)
				if sc < ans:
					ans = sc
					(xa, xb, xc) = (a, b, c)
	return (ans, xa, xb, xc)
T = int(input())
for ti in range(T):
	(A, B, C) = map(int, input().split())
	(step, a, b, c) = sove(A, B, C)
	print(step)
	print('{} {} {}'.format(a, b, c))


n = int(input())
for _ in range(n):
	mini = 100000000
	(a, b, c) = map(int, input().split())
	(a1, b1, c1) = (0, 0, 0)
	for i in range(1, 2 * a + 2):
		for j in range(i, 2 * b + 2, i):
			for k in range(2):
				y = c // j * j + j * k
				if abs(a - i) + abs(b - j) + abs(c - y) < mini:
					mini = abs(a - i) + abs(b - j) + abs(c - y)
					a1 = i
					b1 = j
					c1 = y
	print(mini)
	print(a1, b1, c1)


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for _ in range(0, t):
	(a, b, c) = list(map(int, input().split()))
	i = 1
	ans = 9999999
	stop1 = 999999
	pairs = [0, 0, 0]
	while i < 10001:
		j = i
		while j < 10510:
			k = j
			stop1 = 9999999
			while k < 10500:
				diff = abs(a - i) + abs(b - j) + abs(c - k)
				if stop1 < diff:
					break
				stop1 = diff
				if diff < ans:
					stop = diff
					ans = diff
					pairs = [i, j, k]
				k = k + j
			j = j + i
		i = i + 1
	print(ans)
	print(*pairs)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 100000000000
	aa = 0
	bb = 0
	cc = 0
	for i in range(1, 11000):
		for j in range(i, 11000, i):
			for k in range(j, 11000, j):
				if j % i == 0 and k % j == 0:
					m = abs(a - i) + abs(b - j) + abs(c - k)
					if m < ans:
						aa = i
						bb = j
						cc = k
						ans = m
						if ans == 0:
							break
			if ans == 0:
				break
		if ans == 0:
			break
	print(ans)
	print(aa, bb, cc)


maxn = 20000
maxx = 10000000000
bf = [[] for x in range(maxn)]
nx = [[] for x in range(maxn)]
for i in range(1, maxn):
	for j in range(i, maxn, i):
		bf[j].append(i)
		nx[i].append(j)
tc = int(input())
for asd in range(tc):
	(a, b, c) = [int(x) for x in input().split()]
	mi = maxx
	nums = (0, 0, 0)
	for i in range(1, maxn):
		le = maxx
		for j in bf[i]:
			if abs(a - j) < abs(a - le):
				le = j
		ri = maxx
		for j in nx[i]:
			if abs(c - j) < abs(c - ri):
				ri = j
		if abs(c - ri) + abs(a - le) + abs(i - b) < mi:
			nums = (le, i, ri)
			mi = abs(c - ri) + abs(a - le) + abs(i - b)
	print(mi)
	print(nums[0], nums[1], nums[2])


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')
import math
testcases = int(input())
for j in range(testcases):
	(a, b, c) = map(int, input().split())
	moves = 4 * 10 ** 4
	ans = [a, b, c]
	for s in range(1, 10 ** 4 + 10 ** 2):
		b1 = s
		minb = 10 ** 4 + 1
		rem1 = abs(b - s)
		if rem1 <= minb:
			minb = rem1
		mina = 10 ** 4 + 1
		a1 = a
		for k in range(1, math.ceil(math.sqrt(b1)) + 1):
			if s % k == 0:
				second = s // k
				rem1 = abs(a - k)
				if rem1 < mina:
					mina = rem1
					a1 = k
				rem2 = abs(a - second)
				if rem2 < mina:
					mina = rem2
					a1 = second
		minc = 10 ** 4 + 1
		c1 = c
		if c >= s:
			rem1 = c % s
			rem2 = -c % s
			if rem1 < minc:
				minc = rem1
				c1 = c - rem1
			if rem2 < minc:
				minc = rem2
				c1 = c + rem2
		else:
			rem2 = -c % s
			if rem2 < minc:
				minc = rem2
				c1 = c + rem2
		if mina + minb + minc < moves:
			moves = mina + minb + minc
			ans = [a1, b1, c1]
	print(moves)
	print(*ans)


ran = 20001

def solve():
	(a, b, c) = [int(x) for x in input().split()]
	ans = int(1000000000.0)
	for (B, divsB) in zip(range(1, ran), [divs[x] for x in range(1, ran)]):
		curr = int(abs(B - b))
		ile = c // B
		if int(abs(ile * B - c)) <= int(abs((ile + 1) * B - c)):
			curr += int(abs(ile * B - c))
			C = ile * B
		else:
			curr += int(abs((ile + 1) * B - c))
			C = (ile + 1) * B
		ansA = int(1000000000.0)
		for d in divsB:
			if int(abs(d - a)) < ansA:
				ansA = int(abs(d - a))
				A = d
		curr += ansA
		if curr < ans:
			ans = curr
			ra = A
			rb = B
			rc = C
	print(ans)
	print(ra, rb, rc)
divs = [[] for x in range(0, ran)]
for a in range(1, ran):
	for b in range(a, ran, a):
		divs[b].append(a)
t = int(input())
for _ in range(t):
	solve()


def findDivNum(num):
	a = int(num ** 0.5)
	k = []
	for i in range(1, a + 1):
		if num % i == 0:
			k.append(i)
			if int(num / i) != i:
				k.append(int(num / i))
	return k
allDiv = [findDivNum(i) for i in range(2, 10001)]
t = int(input())
debug = False
for k in range(t):
	param = str(input()).split()
	(a, b, c) = (int(param[0]), int(param[1]), int(param[2]))
	maxN = 10000
	final = 4 * 10000
	ansList = [0, 0, 0]
	for div in range(1, maxN + 1):
		(aList, bList, cList) = (0, 0, 0)
		if div == 1:
			ans = abs(b - div) + abs(a - div)
			if ans < final:
				final = ans
				ansList = [div, div, c]
			continue
		aTemp = div
		modAbove = 10000 % aTemp
		newNumber = aTemp - modAbove + 10000
		tempAns = abs(a - aTemp) + abs(b - newNumber) + abs(c - newNumber)
		if tempAns < final:
			final = tempAns
			aList = aTemp
			bList = newNumber
			cList = newNumber
			ansList = [aList, bList, cList]
		ans = 0
		bAns = abs(b - div)
		bList = div
		if c % div <= div - c % div and c >= div:
			cAns = c % div
			cList = c - c % div
		else:
			cAns = div - c % div
			cList = c + (div - c % div)
		aAns = 3 * 10000
		for divisor in allDiv[div - 2]:
			if abs(a - divisor) < aAns:
				aAns = abs(a - divisor)
				aList = divisor
		ans = bAns + cAns + aAns
		if ans < final:
			ansList = [aList, bList, cList]
			final = ans
	if debug:
		if k > 50:
			print(final, a, b, c)
	else:
		print(final)
		print(str(ansList[0]) + ' ' + str(ansList[1]) + ' ' + str(ansList[2]))


import sys
int1 = lambda x: int(x) - 1
p2D = lambda x: print(*x, sep='\n')

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

def MI():
	return map(int, sys.stdin.readline().split())

def LI():
	return list(map(int, sys.stdin.readline().split()))

def LLI(rows_number):
	return [LI() for _ in range(rows_number)]

def SI():
	return sys.stdin.readline()[:-1]

def main():
	t = II()
	for _ in range(t):
		(a, b, c) = MI()
		ans = 10 ** 6
		xyz = [0] * 3
		for x in range(1, 2 * a):
			for y in range(x, 2 * b, x):
				for d in range(2):
					co = c // y
					z = y * (co + d)
					cur = abs(a - x) + abs(b - y) + abs(c - z)
					if y <= z and cur < ans:
						ans = cur
						xyz = [x, y, z]
		print(ans)
		print(*xyz)
main()


from sys import stdin, stdout
import bisect as bs
from collections import defaultdict
for _ in range(int(stdin.readline())):
	(a, b, c) = list(map(int, stdin.readline().split()))
	pair = [1, 1, 1]
	ans = float('inf')
	for a1 in range(1, 2 * a + 1, 1):
		for b1 in range(a1, 100000, a1):
			c1 = c // b1 * b1
			c2 = c1 + b1
			diff = 0
			chosen = 0
			if c1 == 0:
				diff = abs(c2 - c)
				chosen = c2
			elif abs(c - c1) <= abs(c - c2):
				chosen = c1
				diff = abs(c - c1)
			else:
				chosen = c2
				diff = abs(c - c2)
			cur = abs(a - a1) + abs(b - b1) + diff
			if cur < ans:
				ans = cur
				pair = [a1, b1, chosen]
	print(ans)
	print(*pair)


import math
t = int(input())
for tt in range(t):
	(a, b, c) = map(int, input().split())
	aa = -1
	bb = -1
	cc = -1
	mm = 100000000000000000000
	for ai in range(1, 2 * a + 1):
		for bi in range(ai, 2 * b + 1, ai):
			for i in range(2):
				C = bi * (c // bi) + i * bi
				temp = abs(ai - a) + abs(bi - b) + abs(C - c)
				if temp < mm:
					mm = temp
					aa = ai
					bb = bi
					cc = C
	print(mm)
	print(aa, bb, cc)


import math
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	minn = math.inf
	for i in range(1, 2 * a + 1):
		for j in range(i, 2 * b + 1, i):
			for k in range(2):
				cC = j * (c // j) + k * j
				ans = abs(i - a) + abs(j - b) + abs(cC - c)
				if ans < minn:
					minn = ans
					A = i
					B = j
					C = cC
	print(minn)
	print(A, B, C)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	(at, bt, ct) = (1, 1, 1)
	ans = 10 ** 12
	for i in range(1, 10 ** 4 + 100):
		for j in range(i, 10 ** 4 + 100, i):
			for k in range(j, 10 ** 4 + 100, j):
				s = abs(a - i) + abs(b - j) + abs(c - k)
				if ans > s:
					ans = min(ans, s)
					(A, B, C) = (i, j, k)
	print(ans)
	print(A, B, C)


def satisfy(a, b, c):
	if b % a == 0 and c % b == 0:
		return True
	else:
		return False

def statciA_minStep(a, b):
	b_Mod_a = b % a
	global ansC
	if a - b_Mod_a > b_Mod_a:
		ansC = b - b_Mod_a
		return b_Mod_a
	else:
		ansC = b + a - b_Mod_a
		return a - b_Mod_a

def staticA_minStep(a, b, c):
	b_div_a = int(b // a)
	c_div_a = int(c // a)
	minStep = 10000000
	global ansB
	for i in range(c_div_a + 1):
		newb = a * (i + 1)
		step = abs(newb - b) + statciA_minStep(newb, c)
		if step < minStep:
			minStep = step
			ansB = newb
	return minStep
caseNum = int(input())
ansA = 0
ansB = 0
ansC = 0
for i in range(caseNum):
	(a, b, c) = map(int, input().split())
	minStep = 10000000
	for j in range(c):
		if j > minStep:
			break
		aStep = j
		a1 = a - j
		a2 = a + j
		if a1 > 0:
			totalStep1 = aStep + staticA_minStep(a1, b, c)
			if totalStep1 < minStep:
				minStep = totalStep1
				ansA = a1
		totalStep2 = aStep + staticA_minStep(a2, b, c)
		if totalStep2 < minStep:
			minStep = totalStep2
			ansA = a2
	staticA_minStep(ansA, b, c)
	statciA_minStep(ansB, c)
	print(minStep)
	print(ansA, ansB, ansC)


t = int(input())
for y in range(t):
	(a, b, c) = map(int, input().split())
	m = 1000000.0
	ans = []
	for i in range(1, 2 * a + 1):
		ct = abs(a - i)
		for j in range(i, 2 * b + 1, i):
			ct1 = abs(b - j)
			C1 = c // j * j
			C2 = (c // j + 1) * j
			if C2 < j and C1 < j:
				continue
			f = 0
			if C2 >= j:
				ct2 = abs(c - C2)
			if C1 >= j:
				if ct2 > abs(c - C1):
					ct2 = abs(c - C1)
					f = 1
			if ct + ct1 + ct2 < m:
				m = ct + ct1 + ct2
				ans = [i, j]
				if f == 1:
					ans.append(C1)
				else:
					ans.append(C2)
	print(m)
	for i in ans:
		print(i, end=' ')
	print()


import random, math
from copy import deepcopy as dc
from bisect import bisect_left, bisect_right

def solution(a, b, c):
	fin = float('inf')
	(A, B, C) = (0, 0, 0)
	for i in range(1, 11000):
		for j in range(i, 11000, i):
			for k in range(j, 11000, j):
				t = abs(a - i) + abs(b - j) + abs(c - k)
				if t < fin:
					fin = t + 1 - 1
					(A, B, C) = (i, j, k)
	return [fin, A, B, C]

def input_test():
	for _ in range(int(input())):
		(a, b, c) = map(int, input().strip().split(' '))
		out = solution(a, b, c)
		print(out[0])
		print(*out[1:])

def test():
	pass
input_test()


import sys
input = sys.stdin.readline

def main():
	pos = []
	for a in range(1, 10100, 1):
		for b in range(a, 10100, a):
			for c in range(b, 10100, b):
				pos.append([a, b, c])
	for _ in range(int(input())):
		(a, b, c) = map(int, input().split())
		move = 100000000
		ans = []
		for el in pos:
			tmove = abs(a - el[0]) + abs(b - el[1]) + abs(c - el[2])
			if tmove < move:
				move = tmove
				ans = el
		print(move)
		print(*ans)
main()


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	res = (2000000000.0, 0, 0, 0)
	for A in range(1, 2 * a):
		for B in range(A, 2 * b, A):
			t = c % B
			C = c - t if t < B - t else c + B - t
			t = abs(A - a) + abs(B - b) + abs(C - c)
			res = min((t, A, B, C), res)
	print(res[0])
	print(' '.join(map(str, res[1:])))


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 10 ** 9
	A = B = C = 0
	for cA in range(1, 2 * a + 1):
		for cB in range(cA, 2 * b + 1, cA):
			for i in range(2):
				cC = cB * (c // cB) + i * cB
				res = abs(cA - a) + abs(cB - b) + abs(cC - c)
				if ans > res:
					(ans, A, B, C) = (res, cA, cB, cC)
	print(ans)
	print(A, B, C)


t = int(input())
for _ in range(t):
	(a, b, c) = tuple((int(i) for i in input().split(' ')))
	(aCopy, bCopy, cCopy) = (a, b, c)
	m = 30000
	for x in range(1, 11000):
		for y in range(x, 11000, x):
			for z in range(y, 11000, y):
				if m > abs(a - x) + abs(b - y) + abs(c - z):
					m = abs(a - x) + abs(b - y) + abs(c - z)
					aCopy = x
					bCopy = y
					cCopy = z
	print(m)
	print(aCopy, bCopy, cCopy)


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	ans = 10 ** 18
	l = [a, b, c]
	for x in range(1, 2 * b + 1):
		i = 1
		temp1 = abs(x - a)
		while x * (i - 1) <= 2 * c:
			temp2 = temp1
			temp2 += abs(x * i - b)
			temp2 += min(c % (x * i), x * i - c % (x * i))
			if temp2 <= ans:
				ans = temp2
				if c % (x * i) <= x * i - c % (x * i):
					l = [x, i * x, c - c % (x * i)]
				else:
					l = [x, i * x, c + x * i - c % (x * i)]
			i += 1
	print(ans)
	print(*l)


import sys, math, itertools
from collections import Counter, deque, defaultdict
from bisect import bisect_left, bisect_right
from heapq import heappop, heappush, heapify, nlargest
from copy import deepcopy
mod = 10 ** 9 + 7
INF = float('inf')

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

def inpl():
	return list(map(int, sys.stdin.readline().split()))

def inpl_1():
	return list(map(lambda x: int(x) - 1, sys.stdin.readline().split()))

def inps():
	return sys.stdin.readline()

def inpsl(x):
	tmp = sys.stdin.readline()
	return list(tmp[:x])

def err(x):
	print(x)
	exit()

def make_divisors(n):
	divisors = []
	for i in range(1, int(math.sqrt(n)) + 1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n // i)
	return divisors
mkd = [0] + [make_divisors(x) for x in range(1, 20010)]
for _ in range(inp()):
	res = [-1, -1, -1]
	mi = INF
	(a, b, c) = inpl()
	for B in range(1, 2 * c + 1):
		rb = abs(B - b)
		ra = INF
		A = -1
		for div in mkd[B]:
			if abs(div - a) < ra:
				A = div
				ra = abs(div - a)
		tmp = c // B
		tmp = max(1, tmp)
		(C0, C1) = (tmp * B, (tmp + 1) * B)
		(C, rc) = (C0, abs(c - C0)) if abs(c - C0) <= abs(c - C1) else (C1, abs(c - C1))
		if ra + rb + rc < mi:
			mi = ra + rb + rc
			res = [A, B, C]
	print(mi)
	print(*res)


triplets = []
for i in range(1, 11000):
	for j in range(i, 11000, i):
		for k in range(j, 11000, j):
			triplets.append((i, j, k))
for _ in range(int(input())):
	(a, b, c) = map(int, input().split(' '))
	mini = 1000000000000.0
	Ans = None
	for (i, j, k) in triplets:
		z = abs(a - i) + abs(b - j) + abs(c - k)
		if z < mini:
			mini = z
			Ans = (i, j, k)
		if z == 0:
			break
	print(mini)
	print(*Ans)


var = []
for aa in range(1, 10 ** 4 + 500):
	for bb in range(aa, 10 ** 4 + 500, aa):
		for cc in range(bb, 10 ** 4 + 500, bb):
			var += [(aa, bb, cc)]
t = int(input())
for _ in range(0, t):
	(a, b, c) = map(int, input().split())
	(aaa, bbb, ccc) = (-1, -1, -1)
	mod = 10 ** 9 + 7
	for i in var:
		divi = abs(a - i[0]) + abs(b - i[1]) + abs(c - i[2])
		if divi < mod:
			(aaa, bbb, ccc) = (i[0], i[1], i[2])
			mod = divi
	print(mod)
	print(aaa, bbb, ccc)


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	C = int()
	(x1, x2, x3) = (0, 0, 0)
	ans = 10 ** 9
	for A in range(1, 2 * a):
		for B in range(A, 2 * b + 1, A):
			q = c % B
			mn = min(q, B - q)
			if q == mn:
				C = c - mn
			else:
				C = c + mn
			res = abs(a - A) + abs(b - B) + abs(c - C)
			if res < ans:
				ans = res
				x1 = A
				x2 = B
				x3 = C
	print(ans)
	print(x1, x2, x3)


import os
import sys
from io import BytesIO, IOBase
input = sys.stdin.readline

def inp():
	return int(input())

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

def insr():
	s = input()
	return list(s[:len(s) - 1])

def invr():
	return map(int, input().split())
from math import floor

def main():
	try:
		for _ in range(inp()):
			(a, b, c) = invr()
			ans = 10 ** 9
			for ca in range(1, 2 * a + 1):
				for cb in range(ca, 2 * b + 1, ca):
					for i in range(2):
						cc = cb * (c // cb) + i * cb
						res = abs(ca - a) + abs(cb - b) + abs(cc - c)
						if ans > res:
							ans = res
							A = ca
							B = cb
							C = cc
			print(ans)
			print(A, B, C)
	except Exception as e:
		print(e)
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')
main()


from sys import stdout, stdin, setrecursionlimit
from io import BytesIO, IOBase
from os import *

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 = read(self._fd, max(fstat(self._fd).st_size, 8192))
			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 = read(self._fd, max(fstat(self._fd).st_size, 8192))
			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:
			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')
(stdin, stdout) = (IOWrapper(stdin), IOWrapper(stdout))

def fast():
	return stdin.readline().strip()

def zzz():
	return [int(i) for i in fast().split()]
(z, zz) = (fast, lambda : list(map(int, z().split())))
(szz, graph, mod, szzz) = (lambda : sorted(zz()), {}, 10 ** 9 + 7, lambda : sorted(zzz()))

def lcd(xnum1, xnum2):
	return xnum1 * xnum2 // gcd(xnum1, xnum2)

def output(answer, end='\n'):
	stdout.write(str(answer) + end)
dx = [-1, 1, 0, 0, 1, -1, 1, -1]
dy = [0, 0, 1, -1, 1, -1, -1, 1]
tests = int(z())
for test in range(tests):
	(a, b, c) = zzz()
	res = float('inf')
	(A, B, C) = (0, 0, 0)
	for i in range(1, 11000):
		for j in range(i, 11000, i):
			for k in range(j, 11000, j):
				ans = abs(i - a) + abs(j - b) + abs(k - c)
				if ans < res:
					res = ans
					(A, B, C) = (i, j, k)
	output(res)
	output(A, ' ')
	output(B, ' ')
	output(C, ' ')


def gcd(a, b):
	if a == 0:
		return b
	return gcd(b % a, a)

def lcm(a, b):
	return a * b / gcd(a, b)
for _ in range(int(input())):
	ct = float('inf')
	(a, b, c) = map(int, input().split())
	ca = cb = cc = 0
	for pa in range(1, 10 ** 4 + 101):
		i = 1
		while pa * i <= 10 ** 4 + 100:
			pb = pa * i
			j = 1
			while pb * j <= 10 ** 4 + 100:
				pc = j * pb
				val = abs(pa - a) + abs(pb - b) + abs(pc - c)
				if val < ct:
					ct = val
					ca = pa
					cb = pb
					cc = pc
				j += 1
			i += 1
	print(ct)
	print(ca, cb, cc)


q = int(input())
dz = [set() for i in range(13337)]
dz[1].add(1)
dz[2].add(1)
dz[2].add(2)
for k in range(3, 13337):
	i = 2
	cyk = 0
	while i ** 2 <= k:
		if k % i == 0:
			cyk = 1
			break
		i += 1
	if cyk == 0:
		dz[k].add(1)
		dz[k].add(k)
	else:
		kk = k
		dzi = 1
		while kk % i == 0:
			dzi *= i
			kk //= i
		pom = dz[kk]
		dupa = set()
		for j in pom:
			dupa.add(j * dzi)
		dz[k] = dz[k // i].union(dupa)
for _ in range(q):
	(a, b, c) = map(int, input().split())
	bestie = [a, b, c]
	best = 34739174893

	def wyn(x, y, z):
		return abs(x - a) + abs(y - b) + abs(z - c)
	for z in range(1, 13337):
		if abs(z - c) > best:
			continue
		for y in dz[z]:
			if abs(z - c) + abs(y - b) > best:
				continue
			for x in dz[y]:
				if wyn(x, y, z) < best:
					bestie = [x, y, z]
					best = wyn(x, y, z)
	print(best)
	print(*bestie)


import sys
input = sys.stdin.readline

def calc_divisors(n):
	divisors = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n // i)
	divisors.sort()
	return divisors
divisors = [[] for _ in range(2 * 10 ** 4 + 10)]
for i in range(1, 2 * 10 ** 4 + 10):
	divisors[i] = calc_divisors(i)
t = int(input())
for _ in range(t):
	ans = 10 ** 12
	(a, b, c) = [int(item) for item in input().split()]
	debug = None
	for bb in range(1, 2 * 10 ** 4):
		bdiff = abs(bb - b)
		if bb >= c:
			cc = bb
			cdiff = bb - c
		else:
			small = bb * (c // bb)
			large = bb * ((c + bb - 1) // bb)
			if abs(small - c) < abs(large - c):
				cdiff = abs(small - c)
				cc = small
			else:
				cdiff = abs(large - c)
				cc = large
		adiff = 10 ** 12
		for item in divisors[bb]:
			if abs(item - a) < adiff:
				aa = item
				adiff = abs(item - a)
		val = adiff + bdiff + cdiff
		if val < ans:
			aans = aa
			bans = bb
			cans = cc
			ans = val
			debug = (adiff, bdiff, cdiff)
	print(ans)
	print(aans, bans, cans)


for t in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 10 ** 9
	ar = []
	for A in range(1, 2 * a):
		for B in range(A, 2 * b, A):
			C1 = c - c % B
			C2 = c + B - c % B
			if C1 > 0 and C1 >= B:
				if ans > abs(a - A) + abs(b - B) + abs(c - C1):
					ans = abs(a - A) + abs(b - B) + abs(c - C1)
					ar = [A, B, C1]
			if C2 > 0 and C2 >= B:
				if ans > abs(a - A) + abs(b - B) + abs(c - C2):
					ans = abs(a - A) + abs(b - B) + abs(c - C2)
					ar = [A, B, C2]
	print(ans)
	print(ar[0], ar[1], ar[2])


I = lambda : list(map(int, input().split()))
for _ in range(int(input())):
	(a, b, c) = I()
	(A, B, C) = (0, 0, 0)
	res = 1000000000.0
	for i in range(1, 2 * a + 1):
		for j in range(i, 2 * b + 1, i):
			x = c // j * j
			x1 = c // j * j + j
			temp = -1
			other = -1
			if abs(c - x) < abs(c - x1):
				temp = abs(c - x)
				other = x
			else:
				temp = abs(c - x1)
				other = x1
			cur = abs(a - i) + abs(b - j) + temp
			if res > cur:
				res = cur
				A = i
				B = j
				C = other
	print(res)
	print(A, B, C)


import math
t = int(input())
for i in range(t):
	line = input().split()
	a = int(line[0])
	b = int(line[1])
	c = int(line[2])
	best = 10000000
	bestPossibility = [0, 0, 0]
	for delta in range(0, c + 1):
		aPossibility = a + delta
		if delta >= best:
			break
		for bPossibility in range(aPossibility, math.ceil(c / aPossibility) * aPossibility + 1, aPossibility):
			operations = delta + abs(b - bPossibility)
			if operations >= best:
				continue
			cPossibility = round(c / bPossibility) * bPossibility
			if cPossibility < bPossibility:
				cPossibility = bPossibility
			operations += abs(c - cPossibility)
			if operations < best:
				best = operations
				bestPossibility = [aPossibility, bPossibility, cPossibility]
		aPossibility = a - delta
		if delta >= best:
			break
		if aPossibility > 0:
			for bPossibility in range(aPossibility, math.ceil(c / aPossibility) * aPossibility + 1, aPossibility):
				operations = delta + abs(b - bPossibility)
				if operations >= best:
					continue
				cPossibility = round(c / bPossibility) * bPossibility
				if cPossibility < bPossibility:
					cPossibility = bPossibility
				operations += abs(c - cPossibility)
				if operations < best:
					best = operations
					bestPossibility = [aPossibility, bPossibility, cPossibility]
	print(best)
	print(bestPossibility[0], bestPossibility[1], bestPossibility[2])


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	best = float('inf')
	best_pair = None
	for A in range(1, 2 * a + 1):
		B = A
		while B <= 2 * b:
			(c1, c2) = (B * (c // B), B * (c // B) + B)
			C = None
			if abs(c1 - c) > abs(c2 - c):
				C = c2
			else:
				C = c1
			if abs(a - A) + abs(b - B) + abs(c - C) < best:
				best_pair = (A, B, C)
				best = abs(a - A) + abs(b - B) + abs(c - C)
			B += A
	print(best)
	print(*best_pair)


from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
fac_dict = dict()
for i in range(1, 11000):
	fac_dict[i] = factors(i)
t = int(input().strip())
for _ in range(t):
	(a, b, c) = map(int, input().strip().split())
	ans = 100000
	ans_list = [0, 0, 0]
	for i in range(max(1, c - 5000), min(11000, c + 5000)):
		for first_fac in fac_dict[i]:
			if abs(c - i) + abs(b - first_fac) > ans:
				continue
			for sec_fac in fac_dict[first_fac]:
				cost = abs(c - i) + abs(b - first_fac) + abs(a - sec_fac)
				if cost < ans:
					ans = cost
					ans_list[2] = i
					ans_list[1] = first_fac
					ans_list[0] = sec_fac
	print(ans)
	print(' '.join((str(i) for i in ans_list)))


from sys import stdin
from collections import deque
import math
input = stdin.readline
factorsList = [0 for j in range(15001)]
for i in range(1, 15001):
	leftDeque = deque()
	rightDeque = deque()
	for j in range(1, math.floor(math.sqrt(i)) + 1):
		if i % j == 0:
			leftDeque.append(j)
			rightDeque.appendleft(i // j)
	if math.sqrt(i) == rightDeque[0]:
		rightDeque.popleft()
	factorsList[i] = leftDeque + rightDeque

def getOptimalC(b, c):
	if c % b == 0:
		return c
	mod = c % b
	if mod <= b - mod:
		return c - mod
	else:
		return c + b - mod

def getOptimalA(a, b):
	ind = -1
	for e in range(len(factorsList[b])):
		if factorsList[b][e] == a:
			return a
		if factorsList[b][e] > a:
			ind = e
			break
	lower = factorsList[b][e - 1]
	higher = factorsList[b][e]
	if a - lower < higher - a:
		return lower
	else:
		return higher
t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	lowestTing = 30000
	lowestTrio = [-1, -1, -1]
	for i in range(1, 15001):
		d = getOptimalC(i, c)
		e = getOptimalA(a, i)
		if abs(e - a) + abs(i - b) + abs(d - c) < lowestTing:
			lowestTing = abs(e - a) + abs(i - b) + abs(d - c)
			lowestTrio = [e, i, d]
	print(lowestTing)
	print(*lowestTrio)


numTest = int(input())
N = 30005
for test in range(numTest):
	a = list(map(int, input().strip().split()))
	dp = [[N] * N for i in range(3)]
	tr = [[-1] * N for i in range(3)]
	for x in range(2 * a[0] + 1):
		dp[0][x] = abs(x - a[0])
	for i in range(1, 3):
		for x in range(1, 2 * a[i - 1] + 1):
			for y in range(x, 2 * a[i], x):
				val = dp[i - 1][x] + abs(y - a[i])
				if dp[i][y] > val:
					dp[i][y] = val
					tr[i][y] = x
	pos = 1
	for x in range(1, N):
		if dp[2][pos] > dp[2][x]:
			pos = x
	print(dp[2][pos])
	vRes = [pos]
	for i in range(2, 0, -1):
		pos = tr[i][pos]
		vRes.append(pos)
	vRes.reverse()
	for i in range(0, 3):
		print(vRes[i], end=' ')
	print()


import sys
input = sys.stdin.readline

def make_divisors(n):
	divisors = []
	for k in range(1, int(n ** 0.5) + 1):
		if n % k == 0:
			divisors.append(k)
			if k != n // k:
				divisors.append(n // k)
	divisors = sorted(divisors)
	return divisors
div_list = [None] * (10 ** 4 + 30)
for i in range(1, 10 ** 4 + 30):
	div_list[i] = make_divisors(i)
t = int(input())
INF = 10 ** 6
for _ in range(t):
	ans_a = -1
	ans_b = -1
	ans_c = -1
	ans = INF
	(a, b, c) = list(map(int, input().split()))
	for tmp_b in range(1, 10 ** 4 + 30):
		cost_b = abs(b - tmp_b)
		cost_a = INF
		for tmp_a in div_list[tmp_b]:
			if cost_a > abs(a - tmp_a):
				cost_a = abs(a - tmp_a)
				aa = tmp_a
		cost_c = INF
		num = c // tmp_b
		cost_c = INF
		if cost_c > abs(c - num * tmp_b):
			cost_c = abs(c - num * tmp_b)
			cc = num * tmp_b
		if cost_c > abs(c - (num + 1) * tmp_b):
			cost_c = abs(c - (num + 1) * tmp_b)
			cc = (num + 1) * tmp_b
		if cost_c > abs(c - (num - 1) * tmp_b):
			cost_c = abs(c - (num - 1) * tmp_b)
			cc = (num - 1) * tmp_b
		tmp_ans = cost_a + cost_b + cost_c
		if ans > tmp_ans:
			ans = tmp_ans
			ans_b = tmp_b
			ans_a = aa
			ans_c = cc
	print(ans)
	print(ans_a, ans_b, ans_c)


import sys
input = sys.stdin.buffer.readline
t = int(input())
for i in range(t):
	(a, b, c) = [int(i) for i in input().split()]
	min_s = 10000 + 10000 + 10000 + 7
	mData = 0
	for x1 in range(1, 20000 + 1):
		x2 = x1
		while x2 <= 20000:
			x3 = c // x2 * x2
			x3_ = x3 + x2
			if x3 < 1:
				x3 = 20000 + 20000 + 20000 + 7
			if abs(c - x3_) < abs(c - x3):
				x3 = x3_
			sum_temp = abs(a - x1) + abs(b - x2) + abs(c - x3)
			if sum_temp < min_s:
				min_s = sum_temp
				mData = [x1, x2, x3]
			x2 += x1
	print(min_s)
	print(*mData)


for __ in range(int(input())):
	(a, b, c) = [int(x) for x in input().split()]
	diff = 100000
	(p, q, r) = (a, b, c)
	for i in range(1, 2 * a):
		for j in range(i, 2 * b, i):
			for k in range(j, 2 * c, j):
				if abs(a - i) + abs(b - j) + abs(c - k) < diff:
					diff = abs(a - i) + abs(b - j) + abs(c - k)
					(p, q, r) = (i, j, k)
	print(diff)
	print(p, q, r)


import math

def lcm(x, y):
	p = math.gcd(x, y)
	l = x * y / p
	return l
tc = int(input())
for i in range(tc):
	(a, b, c) = map(int, input().split())
	min1 = 123456789
	x = a
	y = b
	z = c
	for i in range(1, 10001):
		for j in range(i, 100001, i):
			s = int(abs(i - a) + abs(j - b))
			if s > min1:
				continue
			p = lcm(i, j)
			r = p - c % p
			if r == p:
				r = 0
			if c % p < r:
				s += c % p
				r = -(c % p)
			else:
				s += r
			if s < min1:
				min1 = s
				x = i
				y = j
				z = c + r
	print(int(min1))
	print(int(x), int(y), int(z), sep=' ')


MAX = float('inf')
MIN = float('-inf')
MOD = 1000000007
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	(i, j, cc) = (-1, -1, -1)
	ans = MAX
	for i in range(1, 2 * a):
		for j in range(i, 2 * b, i):
			for k in range(2):
				cc = c - c % j + k * j
				cal = abs(i - a) + abs(j - b) + abs(cc - c)
				if ans > cal:
					ans = cal
					A = i
					B = j
					C = cc
	print(ans)
	print(A, B, C)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 10000000000
	cur = 0
	lis = []
	for i in range(1, 2 * a + 1, 1):
		for j in range(i, 2 * b + 1, i):
			for k in range(j, 2 * c + 1, j):
				cur = abs(k - c) + abs(j - b) + abs(a - i)
				if cur <= ans:
					ans = cur
					lis = [i, j, k]
	print(ans)
	print(*lis)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
MAXN = 20021
f = [[1] for i in range(MAXN)]
for i in range(2, MAXN):
	for j in range(i, MAXN, i):
		f[j].append(i)

def solve():
	(a, b, c) = mints()
	ans = (int(1000000000.0), 0, 0, 0)
	for C in range(1, 2 * c + 10):
		dc = abs(C - c)
		for B in f[C]:
			db = abs(B - b)
			for A in f[B]:
				ans = min(ans, (dc + db + abs(A - a), A, B, C))
	print(ans[0])
	print(*ans[1:])
for i in range(mint()):
	solve()


import sys
from functools import lru_cache
from heapq import merge, heapify, heappop, heappush
from math import ceil, floor, gcd, fabs, factorial, fmod, sqrt, inf
from collections import defaultdict as dd, deque, Counter as c
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(var):
	sys.stdout.write(str(var))

def outln(var):
	sys.stdout.write(str(var) + '\n')

def l():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
for _ in range(int(data())):
	(a, b, c) = sp()
	answer = mod
	for i in range(1, pow(10, 4) + 1000):
		for j in range(i, pow(10, 4) + 1000, i):
			for k in range(j, pow(10, 4) + 1000, j):
				temp = abs(a - i) + abs(b - j) + abs(c - k)
				if temp < answer:
					(newa, newb, newc) = (i, j, k)
					answer = temp
	print(answer)
	print(newa, newb, newc)


import math

def rints():
	return list(map(int, input().split()))
t = int(input())
for _ in range(t):
	(a, b, c) = rints()
	best = (1, 1, 1)
	for A in range(1, 10001):
		B = A
		while B <= 12500:
			C = B
			for C in (math.floor(c / B) * B, math.ceil(c / B) * B):
				b_val = abs(a - best[0]) + abs(b - best[1]) + abs(c - best[2])
				c_val = abs(a - A) + abs(b - B) + abs(c - C)
				if b_val > c_val:
					best = (A, B, C)
			B += A
	print(abs(a - best[0]) + abs(b - best[1]) + abs(c - best[2]))
	print(*best)


MOD = 1000000007
MOD2 = 998244353
ii = lambda : int(input())
si = lambda : input()
dgl = lambda : list(map(int, input()))
f = lambda : map(int, input().split())
il = lambda : list(map(int, input().split()))
ls = lambda : list(input())
let = 'abcdefghijklmnopqrstuvwxyz'
for _ in range(ii()):
	(p, q, r) = f()
	ans = 10000000
	(ax, ay, az) = (0, 0, 0)
	for i in range(1, 50003):
		z = 0
		for j in range(i, 50004, i):
			t = abs(q - j)
			if r - (j - r % j) > 0 and j - r % j < r % j:
				t += j - r % j
				z = (r // j + 1) * j
			elif r // j != 0:
				t += r % j
				z = r // j * j
			if ans > t + abs(p - i):
				ans = t + abs(p - i)
				ax = i
				ay = j
				az = z
	print(ans)
	print(ax, ay, az)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = float('inf')
	li = [0, 0, 0]
	for i in range(1, 2 * a + 1):
		x1 = abs(a - i)
		for j in range(i, 2 * b + 1, i):
			x2 = abs(b - j)
			rem = c % j
			qu = c // j
			if rem == 0:
				if x1 + x2 < ans:
					li = [i, j, c]
					ans = x1 + x2
			elif qu == 0:
				if x1 + x2 + j - rem < ans:
					ans = x1 + x2 + j - rem
					li = [i, j, c + j - rem]
			elif x1 + x2 + rem < ans:
				ans = x1 + x2 + rem
				li = [i, j, c - rem]
			elif x1 + x2 + j - rem < ans:
				ans = x1 + x2 + j - rem
				li = [i, j, c + j - rem]
	print(ans)
	print(*li)


tests = int(input())
for te in range(tests):
	(A, B, C) = list(map(int, input().split()))
	maxa = C + 5000
	answer = 10 ** 10
	arr = [-1 for i in range(3)]
	for a in range(1, maxa + 1):
		for b in range(a, maxa + 5, a):
			for c in range(b, maxa + 5, b):
				k = abs(A - a) + abs(B - b) + abs(C - c)
				if k < answer:
					answer = k
					arr[0] = a
					arr[1] = b
					arr[2] = c
	print(answer)
	print(*arr)


for t in range(int(input())):
	(a, b, c) = [*map(int, input().split())]
	res = 1000000000.0
	pr = res
	rabc = []
	for A in range(1, 2 * a):
		for B in range(A, 2 * b, A):
			res = min(res, abs(A - a) + abs(B - b) + min(abs((c // B + 1) * B - c), abs(c // B * B - c)))
			if res != pr:
				pr = res
				rabc = [A, B, (c // B + (1 if abs((c // B + 1) * B - c) < abs(c // B * B - c) else 0)) * B]
	print(res)
	print(*rabc)


import sys
input = sys.stdin.readline
t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	l = 100000000
	for i in range(1, 10100):
		for j in range(i, 10100, i):
			for k in range(j, 10100, j):
				p = abs(a - i) + abs(b - j) + abs(c - k)
				if p < l:
					l = p
					best = [i, j, k]
	print(l)
	print(*best)


from math import *

def binarySearch(arr, x, i):
	l = i
	r = len(arr) - 1
	while l <= r:
		mid = (l + r) // 2
		if arr[mid] == x:
			return mid
		elif arr[mid] < x:
			l = mid + 1
		else:
			r = mid - 1
	return -1

def js(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] <= x:
			ans = m
			l = m + 1
		else:
			r = m - 1
	return ans

def jg(arr, x):
	l = 0
	r = len(arr) - 1
	ans = -1
	while l <= r:
		m = (l + r) // 2
		if arr[m] >= x:
			ans = m
			r = m - 1
		else:
			l = m + 1
	return ans

def s(n):
	f = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			if n % (n // i) == 0 and n % (n // i) != i:
				f.append(n // i)
			f.append(i)
	f.sort()
	return f
t = [[0]]
for i in range(1, 15000):
	t.append(s(i))
for __ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 9999999
	r1 = 0
	r2 = 0
	r3 = 0
	for i in range(1, 15000):
		a1 = t[i][js(t[i], a)]
		a2 = t[i][jg(t[i], a)]
		r2 = i
		if c % i == 0:
			r3 = c
		elif c < i:
			r3 = i
		elif ceil(c / i) * i - c < c - c // i * i:
			r3 = ceil(c / i) * i
		else:
			r3 = c // i * i
		if a - a1 < a2 - a:
			r1 = a1
		else:
			r1 = a2
		if abs(a - r1) + abs(b - r2) + abs(c - r3) < ans:
			ans1 = r1
			ans2 = r2
			ans3 = r3
			ans = abs(a - r1) + abs(b - r2) + abs(c - r3)
	print(ans)
	print(ans1, ans2, ans3)


for _ in range(int(input())):
	(a, b, c) = [int(x) for x in input().split()]
	ans = 1000000000.0
	(A, B, C) = [-1] * 3
	cA = 1
	while cA <= 2 * a:
		cB = cA
		while cB <= 2 * b:
			for i in range(2):
				cC = cB * (c // cB) + i * cB
				res = abs(cA - a) + abs(cB - b) + abs(cC - c)
				if ans > res:
					ans = res
					(A, B, C) = [cA, cB, cC]
			cB += cA
		cA += 1
	print(ans)
	print(A, B, C)


def i():
	return input()

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

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

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

def sum_count(a, b):
	global count
	count += abs(a - b)
t = int(input())
for _ in range(t):
	(a, b, c) = iis()
	best_ans = [a, b, c]
	diff = float('INF')
	for new_a in range(1, 2 * a):
		for new_b in range(new_a, 2 * b, new_a):
			count = 0
			sum_count(a, new_a)
			new_c = max(new_b, c)
			div = new_c % new_b
			if div < new_b - div:
				new_c -= div
			else:
				new_c += new_b - div
			sum_count(b, new_b)
			sum_count(c, new_c)
			if count < diff:
				diff = count
				best_ans = [new_a, new_b, new_c]
	print(diff)
	print(' '.join(map(str, best_ans)))


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	cnt = 10 ** 9
	(A, B, C) = (a, b, c)
	for i in range(1, 2 * a + 1):
		for j in range(i, 2 * b + 1, i):
			cc = c // j * j
			if c - cc > cc + j - c:
				cc = cc + j
			if abs(c - cc) + abs(b - j) + abs(a - i) < cnt and cc >= j:
				(A, B, C) = (i, j, cc)
				cnt = abs(c - C) + abs(b - B) + abs(a - A)
	print(cnt)
	print(A, B, C)


import sys
from functools import lru_cache
input = sys.stdin.readline

@lru_cache(maxsize=None)
def make_divisors(n):
	divisors = []
	for i in range(1, int(n ** 0.5) + 1):
		if n % i == 0:
			divisors.append(i)
			if i != n // i:
				divisors.append(n // i)
	return divisors

def main():
	t = int(input())
	for _ in range(t):
		(A, B, C) = [int(x) for x in input().split()]
		ans = float('inf')
		memo = [0, 0, 0]
		for b in range(1, C + B):
			tmp = abs(B - b)
			divs = make_divisors(b)
			tmp_a = float('inf')
			for a in divs:
				tmp_a = min(tmp_a, abs(A - a))
			x = C // b
			tmp_c = min(abs(C - x * b), abs(C - (x + 1) * b))
			tmp += tmp_c + tmp_a
			tmpans = ans
			ans = min(ans, tmp)
			if ans != tmpans:
				memo[0] = tmp_a
				memo[1] = b
				memo[2] = tmp_c
		print(ans)
		if memo[1] % (A + memo[0]) == 0 and (C + memo[2]) % memo[1] == 0:
			print(A + memo[0], memo[1], C + memo[2])
		elif memo[1] % (A + memo[0]) == 0 and (C - memo[2]) % memo[1] == 0:
			print(A + memo[0], memo[1], C - memo[2])
		elif memo[1] % (A - memo[0]) == 0 and (C + memo[2]) % memo[1] == 0:
			print(A - memo[0], memo[1], C + memo[2])
		elif memo[1] % (A - memo[0]) == 0 and (C - memo[2]) % memo[1] == 0:
			print(A - memo[0], memo[1], C - memo[2])
main()


import random

def get_diff(key, a, b, c):
	diff = abs(a - key)
	tempb = b // key
	if abs(b - tempb * key) > abs(b - (tempb + 1) * key) or tempb == 0:
		tempb += 1
	tempb = tempb * key
	tempc = c // tempb
	if abs(c - tempc * tempb) > abs(c - (tempc + 1) * tempb):
		tempc += 1
	tempc = tempc * tempb
	return (diff + abs(tempb - b) + abs(tempc - c), [key, tempb, tempc])

def process():
	(a, b, c) = list(map(int, input().split()))
	min_diff = 10 ** 6
	min_list = []
	for i in range(1, 2 * a + 2):
		if abs(a - i) > min_diff:
			if i > a:
				break
			continue
		j = i
		while j <= 2 * b + 1:
			if abs(a - i) + abs(b - j) > min_diff:
				if j > b:
					j = 2 * b + 1
				j += i
				continue
			tl = [c // j * j, (1 + c // j) * j]
			for l in tl:
				if abs(i - a) + abs(j - b) + abs(l - c) < min_diff:
					min_diff = abs(i - a) + abs(j - b) + abs(l - c)
					min_list = [i, j, l]
			j += i
	min_list = [str(i) for i in min_list]
	print(min_diff)
	print(' '.join(min_list))
tests = int(input())
for i in range(0, tests):
	process()


(t, s) = (int(input()), '')
while t > 0:
	t -= 1
	(a, b, c) = map(int, input().split())
	ans = 10 ** 5
	p = [0] * 3
	for i in range(1, 2 * 10 ** 4 + 1):
		cur = [i] + [0] * 2
		for j in range(i, 2 * 10 ** 4 + 1, i):
			cur[1] = j
			cur[2] = c - c % j if c % j * 2 < j and c - c % j >= j else c - c % j + j
			cost = abs(cur[0] - a) + abs(cur[1] - b) + abs(cur[2] - c)
			if cost < ans:
				ans = cost
				p = cur.copy()
	s += str(ans) + '\n'
	for i in range(3):
		s += str(p[i]) + ' '
	s += '\n'
print(s)


from math import factorial
from collections import Counter
from heapq import heapify, heappop, heappush
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')

def RL():
	return map(int, sys.stdin.readline().rstrip().split())

def N():
	return int(input())

def comb(n, m):
	return factorial(n) / (factorial(m) * factorial(n - m)) if n >= m else 0

def perm(n, m):
	return factorial(n) // factorial(n - m) if n >= m else 0

def mdis(x1, y1, x2, y2):
	return abs(x1 - x2) + abs(y1 - y2)
mod = 1000000007
INF = float('inf')
import bisect

def main():
	for _ in range(N()):
		(a, b, c) = RL()
		res = INF
		ret = (-1, -1, -1)
		for i in range(1, 2 * a + 1):
			for j in range(i, 2 * b + 1, i):
				(aa, bb) = (i, j)
				dif = abs(aa - a) + abs(bb - b)
				for nx in [bb, c // bb * bb, c // bb * bb + bb]:
					op = abs(nx - c)
					td = dif + op
					if td < res:
						res = td
						ret = (aa, bb, nx)
		print(res)
		print(*ret)
main()


import os
import sys
import math
from io import BytesIO, IOBase
from fractions import Fraction
import collections
from itertools import permutations
from collections import defaultdict
from collections import deque
import threading
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')

class SegmentTree:

	def __init__(self, data, default=0, func=lambda a, b: a + b):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)

class SegmentTree1:

	def __init__(self, data, default=10 ** 6, func=lambda a, b: min(a, b)):
		self._default = default
		self._func = func
		self._len = len(data)
		self._size = _size = 1 << (self._len - 1).bit_length()
		self.data = [default] * (2 * _size)
		self.data[_size:_size + self._len] = data
		for i in reversed(range(_size)):
			self.data[i] = func(self.data[i + i], self.data[i + i + 1])

	def __delitem__(self, idx):
		self[idx] = self._default

	def __getitem__(self, idx):
		return self.data[idx + self._size]

	def __setitem__(self, idx, value):
		idx += self._size
		self.data[idx] = value
		idx >>= 1
		while idx:
			self.data[idx] = self._func(self.data[2 * idx], self.data[2 * idx + 1])
			idx >>= 1

	def __len__(self):
		return self._len

	def query(self, start, stop):
		if start == stop:
			return self.__getitem__(start)
		stop += 1
		start += self._size
		stop += self._size
		res = self._default
		while start < stop:
			if start & 1:
				res = self._func(res, self.data[start])
				start += 1
			if stop & 1:
				stop -= 1
				res = self._func(res, self.data[stop])
			start >>= 1
			stop >>= 1
		return res

	def __repr__(self):
		return 'SegmentTree({0})'.format(self.data)
MOD = 10 ** 9 + 7

class Factorial:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorials = [1, 1]
		self.invModulos = [0, 1]
		self.invFactorial_ = [1, 1]

	def calc(self, n):
		if n <= -1:
			print('Invalid argument to calculate n!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.factorials):
			return self.factorials[n]
		nextArr = [0] * (n + 1 - len(self.factorials))
		initialI = len(self.factorials)
		prev = self.factorials[-1]
		m = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * i % m
		self.factorials += nextArr
		return self.factorials[n]

	def inv(self, n):
		if n <= -1:
			print('Invalid argument to calculate n^(-1)')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		p = self.MOD
		pi = n % p
		if pi < len(self.invModulos):
			return self.invModulos[pi]
		nextArr = [0] * (n + 1 - len(self.invModulos))
		initialI = len(self.invModulos)
		for i in range(initialI, min(p, n + 1)):
			next = -self.invModulos[p % i] * (p // i) % p
			self.invModulos.append(next)
		return self.invModulos[pi]

	def invFactorial(self, n):
		if n <= -1:
			print('Invalid argument to calculate (n^(-1))!')
			print('n must be non-negative value. But the argument was ' + str(n))
			exit()
		if n < len(self.invFactorial_):
			return self.invFactorial_[n]
		self.inv(n)
		nextArr = [0] * (n + 1 - len(self.invFactorial_))
		initialI = len(self.invFactorial_)
		prev = self.invFactorial_[-1]
		p = self.MOD
		for i in range(initialI, n + 1):
			prev = nextArr[i - initialI] = prev * self.invModulos[i % p] % p
		self.invFactorial_ += nextArr
		return self.invFactorial_[n]

class Combination:

	def __init__(self, MOD):
		self.MOD = MOD
		self.factorial = Factorial(MOD)

	def ncr(self, n, k):
		if k < 0 or n < k:
			return 0
		k = min(k, n - k)
		f = self.factorial
		return f.calc(n) * f.invFactorial(max(n - k, k)) * f.invFactorial(min(k, n - k)) % self.MOD
mod = 10 ** 9 + 7
omod = 998244353
prime = [True for i in range(10)]
pp = [0] * 10

def SieveOfEratosthenes(n=10):
	p = 2
	c = 0
	while p * p <= n:
		if prime[p] == True:
			c += 1
			for i in range(p, n + 1, p):
				pp[i] += 1
				prime[i] = False
		p += 1

def binarySearch(arr, n, key):
	left = 0
	right = n - 1
	mid = 0
	res = arr[n - 1]
	while left <= right:
		mid = (right + left) // 2
		if arr[mid] >= key:
			res = arr[mid]
			right = mid - 1
		else:
			left = mid + 1
	return res

def binarySearch1(arr, n, key):
	left = 0
	right = n - 1
	mid = 0
	res = arr[0]
	while left <= right:
		mid = (right + left) // 2
		if arr[mid] > key:
			right = mid - 1
		else:
			res = arr[mid]
			left = mid + 1
	return res
for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	m = a + b + c - 3
	res = [1, 1, 1]
	for A in range(1, 2 * a + 1):
		for B in range(A, 2 * b + 1, A):
			d = max(1, c // B)
			c1 = d * B
			c2 = c1 + B
			r = abs(a - A) + abs(b - B) + abs(c - c1)
			if r < m:
				m = r
				res = [A, B, c1]
			r = abs(a - A) + abs(b - B) + abs(c - c2)
			if r < m:
				m = r
				res = [A, B, c2]
	print(m)
	print(*res)


import os
import sys
from io import BytesIO, IOBase
import heapq as h
from bisect import bisect_left, bisect_right
import time
from types import GeneratorType
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

	def __init__(self, file):
		import os
		self.os = os
		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 = self.os.read(self._fd, max(self.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 = self.os.read(self._fd, max(self.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:
			self.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')
from collections import defaultdict as dd, deque as dq, Counter as dc
import math, string
start_time = time.time()

def getInts():
	return [int(s) for s in input().split()]

def getInt():
	return int(input())

def getStrs():
	return [s for s in input().split()]

def getStr():
	return input()

def listStr():
	return list(input())

def getMat(n):
	return [getInts() for _ in range(n)]

def isInt(s):
	return '0' <= s[0] <= '9'
MOD = 998244353

def solve():
	(A, B, C) = getInts()
	best = 10 ** 18
	best_out = [-1, -1, -1]
	for a in range(1, 2 * 10 ** 4 + 1):
		for b in range(a, 2 * 10 ** 4 + 1, a):
			for i in range(2):
				c = b * (C // b) + i * b
				if c < b:
					continue
				x = min(best, abs(a - A) + abs(b - B) + abs(c - C))
				if x < best:
					best = x
					best_out = [a, b, c]
	print(best)
	print(*best_out)
	return
for _ in range(getInt()):
	solve()


bound = 10040
possible_answers = [(i, j, k) for i in range(1, bound) for j in range(i, bound, i) for k in range(j, bound, j)]
t = int(input())
queries = [tuple(map(int, input().split())) for i in range(t)]
ans = []
for (i, j, k) in queries:
	min_cost = 50000
	res = None
	for (a, b, c) in possible_answers:
		cost = abs(a - i) + abs(b - j) + abs(c - k)
		if cost < min_cost:
			res = (a, b, c)
			min_cost = cost
	print(min_cost)
	print(*res)


t = int(input())
for i in range(t):
	line = input()
	[a, b, c] = [int(x) for x in line.split(' ')]
	mincost = 10000000000
	bestsol = [a, b, c]
	for ai in range(1, c * 2):
		ini = ai
		bi = ini
		while bi <= 20001:
			if bi % ai == 0 and abs(bi - b) + abs(ai - a) <= mincost:
				divis = c // bi
				for ci in [divis * bi, divis * bi + bi]:
					if ci % bi == 0 and ci >= bi and (c <= 20001):
						cost = abs(ci - c) + abs(bi - b) + abs(ai - a)
						if cost < mincost:
							bestsol = [ai, bi, ci]
							mincost = cost
			bi += ini
	print(mincost)
	print(' '.join([str(x) for x in bestsol]))


import sys
for _ in range(int(sys.stdin.readline().rstrip())):
	(a, b, c) = list(map(int, sys.stdin.readline().rstrip().split()))
	re = 99999999
	re_arr = [a, b, c]
	for i in range(1, 10001):
		chk_i = abs(i - a)
		if chk_i > re and i > a:
			break
		j = 1
		while True:
			chk_j = chk_i + abs(b - i * j)
			if chk_j > re and i * j > b:
				break
			k = 1
			while True:
				chk_k = chk_j + abs(c - i * j * k)
				if chk_k > re and i * j * k > c:
					break
				elif chk_k < re:
					re = chk_k
					re_arr = [i, i * j, i * j * k]
				k += 1
			j += 1
	print(re)
	for i in re_arr:
		print(i, end=' ')
	print('')


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 10 ** 12
	for i in range(1, 11000):
		for j in range(i, 11000, i):
			for k in range(j, 11000, j):
				s = abs(a - i) + abs(b - j) + abs(c - k)
				if ans > s:
					ans = s
					(tA, tB, tC) = (i, j, k)
	print(ans)
	print(tA, tB, tC)


from sys import stdin
T = int(input())
for _ in range(T):
	(a, b, c) = map(int, stdin.readline().split())
	ans = 10 ** 8
	for A in range(1, 2 * a + 1):
		for B in range(A, 2 * b + 1, A):
			q_cb = c // B
			c_1 = q_cb * B
			c_2 = q_cb * B + B
			if c - c_1 >= c_2 - c:
				C = c_2
			else:
				C = c_1
			if abs(A - a) + abs(B - b) + abs(C - c) < ans:
				ans = abs(A - a) + abs(B - b) + abs(C - c)
				s = [A, B, C]
	print(ans)
	print(*s)


import bisect
t = int(input())
q = []
ans = [float('inf')] * t
ansabc = [[0] * 3 for i in range(t)]
for loop in range(t):
	(a, b, c) = map(int, input().split())
	q.append([a, b, c])
for nb in range(1, 30001):
	mlis = []
	now = 1
	while now ** 2 <= nb:
		if now ** 2 == nb:
			mlis.append(now)
			break
		elif nb % now == 0:
			mlis.append(now)
			mlis.append(nb // now)
		now += 1
	mlis.sort()
	mlis.append(float('inf'))
	for i in range(t):
		(a, b, c) = q[i]
		nans = abs(b - nb)
		if c < nb:
			nans += nb - c
			ansc = nb
		else:
			if c % nb < nb - c % nb:
				ansc = c // nb * nb
			else:
				ansc = c // nb * nb + nb
			nans += min(c % nb, nb - c % nb)
		ind = bisect.bisect_left(mlis, a)
		if abs(a - mlis[ind]) < abs(a - mlis[ind - 1]):
			ansa = mlis[ind]
		else:
			ansa = mlis[ind - 1]
		nans += min(abs(a - mlis[ind]), abs(a - mlis[ind - 1]))
		if ans[i] > nans:
			ans[i] = nans
			ansabc[i] = [ansa, nb, ansc]
for i in range(t):
	print(ans[i])
	print(' '.join(map(str, ansabc[i])))


from sys import stdin, stdout
import traceback
from collections import deque
read = lambda : stdin.readline().strip()
write = stdout.write
writeln = lambda x: write(str(x) + '\n')

def reads(typ=int):
	return list(map(typ, read().split()))

class Sol:

	def __init__(self, a, b, c):
		self.a = a
		self.b = b
		self.c = c
		self.ret = 30000
		self.best = (1, 1, 1)

	@classmethod
	def input(cls):
		(a, b, c) = reads()
		return cls(a, b, c)

	def solve(self):
		for n in range(1, 11001):
			for m in range(1, 11000 // n + 1):
				for base in range(1, 11000 // (m * n) + 1):
					self.check(n, m, base)
		return (self.ret, self.best)

	def check(self, n, m, base):
		new_a = base
		new_b = base * n
		new_c = base * n * m
		ret = abs(new_a - self.a) + abs(new_b - self.b) + abs(new_c - self.c)
		if ret < self.ret:
			self.ret = ret
			self.best = (new_a, new_b, new_c)
try:
	for _ in range(int(read())):
		(res, best) = Sol.input().solve()
		writeln(res)
		writeln(' '.join([str(x) for x in best]))
except Exception as e:
	print('Got exception:', repr(e))
	print(traceback.format_exc())


import sys
input = sys.stdin.readline

def main():
	t = int(input())
	for _ in range(t):
		(a, b, c) = map(int, input().split())
		a1 = 0
		b1 = 0
		c1 = 0
		mv = 300000
		for i in range(1, 2 * a):
			for j in range(i, 2 * b, i):
				k = c // j * j
				if mv > abs(c - k) + abs(b - j) + abs(i - a):
					mv = abs(c - k) + abs(b - j) + abs(i - a)
					a1 = i
					b1 = j
					c1 = k
				k = c // j * j + j
				if mv > abs(c - k) + abs(b - j) + abs(i - a):
					mv = abs(c - k) + abs(b - j) + abs(i - a)
					a1 = i
					b1 = j
					c1 = k
		print(int(mv))
		print(a1, b1, c1)
main()


def distance(a, b, c, d, e, f):
	return abs(a - d) + abs(b - e) + abs(c - f)
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = (1, 1, 1)
	ans_dist = 999999999999999
	for first in range(1, pow(10, 4) + 1000):
		for second in range(first, pow(10, 4) + 1000, first):
			for third in range(second, pow(10, 4) + 1000, second):
				possibility = (first, second, third)
				if distance(first, second, third, a, b, c) < ans_dist:
					ans = (first, second, third)
					ans_dist = distance(*ans, a, b, c)
	print(ans_dist)
	print(*ans)


t = int(input())
while t:
	t -= 1
	(a, b, c) = map(int, input().split())
	ans = 10 ** 9
	for i in range(1, 2 * a + 1):
		for j in range(i, 2 * b, i):
			cur = abs(i - a) + abs(b - j)
			if c % j < j - c % j:
				if cur + c % j < ans:
					ans = cur + c % j
					l = [i, j, c - c % j]
			elif cur + j - c % j < ans:
				ans = cur + j - c % j
				l = [i, j, c + j - c % j]
	print(ans)
	print(*l)


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	mincost = 10 ** 20
	ans = ()
	for i in range(1, 10001):
		for j in range(i, 20001, i):
			cur = abs(i - a) + abs(j - b)
			k1 = c // j * j
			k2 = k1 + j
			if k1 >= j:
				cur1 = cur + abs(k1 - c)
			if k2 >= j:
				cur2 = cur + abs(k2 - c)
			if cur1 < mincost:
				mincost = cur1
				ans = (i, j, k1)
			if cur2 < mincost:
				mincost = cur2
				ans = (i, j, k2)
	print(mincost)
	print(*ans)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	mx = 1000000000
	sm = 0
	t1 = 0
	t2 = 0
	t3 = 0
	for i in range(1, 2 * a + 1):
		sm = abs(a - i)
		k = 1
		while i * k <= 2 * b:
			if k > 0:
				temp_b = i * k
				dif1 = abs(temp_b - b)
				c1 = c // temp_b
				if c1 > 0:
					temp_c = temp_b * c1
					dif2 = abs(temp_c - c)
					if mx > min(mx, sm + dif1 + dif2):
						mx = min(mx, sm + dif1 + dif2)
						t1 = i
						t2 = temp_b
						t3 = temp_c
				temp_c = temp_b * (c1 + 1)
				dif2 = abs(temp_c - c)
				if mx > min(mx, sm + dif1 + dif2):
					mx = min(mx, sm + dif1 + dif2)
					t1 = i
					t2 = temp_b
					t3 = temp_c
			k += 1
	print(mx)
	print(t1, t2, t3)


import bisect
import heapq
import math
import random
import sys
from collections import Counter, defaultdict, deque
from decimal import ROUND_CEILING, ROUND_HALF_UP, Decimal
from functools import lru_cache, reduce
from itertools import combinations, combinations_with_replacement, product, permutations
from operator import add, mul, sub
sys.setrecursionlimit(100000)
input = sys.stdin.readline
INF = 2 ** 62 - 1

def read_int():
	return int(input())

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

def read_float():
	return float(input())

def read_float_n():
	return list(map(float, input().split()))

def read_str():
	return input().strip()

def read_str_n():
	return list(map(str, input().split()))

def error_print(*args):
	print(*args, file=sys.stderr)

def mt(f):
	import time

	def wrap(*args, **kwargs):
		s = time.time()
		ret = f(*args, **kwargs)
		e = time.time()
		error_print(e - s, 'sec')
		return ret
	return wrap

@mt
def slv(ABC):
	(A, B, C) = ABC
	M = 10 ** 4
	ans = (INF, None)
	for a in range(1, M + 1):
		ac = abs(A - a)
		for x in range(1, -(-M // a) + 1):
			bc = abs(B - x * a)
			for y in range(1, -(-M // (a * x)) + 1):
				cc = abs(C - x * y * a)
				s = ac + bc + cc
				assert a <= x * a <= x * y * a
				if s < ans[0]:
					ans = (s, (a, x * a, x * y * a))
	print(ans[0])
	print(*ans[1])

def main():
	T = read_int()
	for _ in range(T):
		ABC = read_int_n()
		slv(ABC)
main()


mod = 9999999999
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	answer = mod
	for i in range(1, pow(10, 4) + 1000):
		for j in range(i, pow(10, 4) + 1000, i):
			for k in range(j, pow(10, 4) + 1000, j):
				temp = abs(a - i) + abs(b - j) + abs(c - k)
				if temp < answer:
					(newa, newb, newc) = (i, j, k)
					answer = temp
	print(answer)
	print(newa, newb, newc)


import os
import sys
from io import BytesIO, IOBase
from itertools import accumulate

def main():
	for _ in range(int(input())):
		(a, b, c) = map(int, input().split())
		ans = float('inf')
		for i in range(1, 20000):
			for j in range(i, 20000, i):
				for k in range(j, 20000, j):
					if abs(a - i) + abs(b - j) + abs(c - k) < ans:
						ans = abs(a - i) + abs(b - j) + abs(c - k)
						aa = i
						bb = j
						cc = k
		print(ans)
		print(aa, bb, cc)
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')
main()


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')
from functools import reduce

def factors(n):
	return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))
facts = [list(factors(n)) for n in range(1, 2 * 10 ** 4 + 1)]
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	mdist = 10 ** 9
	ans = 0
	for i in range(2 * 10 ** 4):
		f = facts[i]
		clo = abs(f[0] - a)
		for each in f:
			clo = min(clo, abs(each - a))
		clo += min(c % (i + 1), i + 1 - c % (i + 1))
		md = clo + abs(b - (i + 1))
		if md < mdist:
			mdist = md
			ans = i
	print(mdist)
	f = facts[ans]
	clo = abs(f[0] - a)
	aa = f[0]
	for each in f:
		if abs(each - a) < clo:
			clo = min(clo, abs(each - a))
			aa = each
	cc = int(c / (ans + 1)) * (ans + 1)
	if c % (ans + 1) > ans + 1 - c % (ans + 1):
		cc += ans + 1
	print(aa, ans + 1, cc)


t = int(input())
while t:
	(a, b, c) = map(int, input().split())
	ans = [10 ** 18, a, b, c]
	for i in range(1, 2 * 10 ** 4 + 1):
		for j in range(0, 2 * 10 ** 4 + 1, i):
			if j == 0:
				continue
			if c % j < j - c % j:
				temp = [abs(i - a) + abs(j - b) + c % j, i, j, c - c % j]
			else:
				temp = [abs(i - a) + abs(j - b) + j - c % j, i, j, c + j - c % j]
			if temp[0] < ans[0]:
				ans = temp
	print(ans[0])
	print(ans[1], ans[2], ans[3])
	t -= 1


import sys
input = sys.stdin.readline
t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	(A, B, C) = (-1, -1, -1)
	val = 10 ** 18
	for ca in range(1, 2 * a + 1):
		for cb in range(ca, 2 * b, ca):
			for i in range(2):
				cc = cb * (c // cb) + i * cb
				score = abs(ca - a) + abs(cb - b) + abs(cc - c)
				if val > score:
					val = score
					A = ca
					B = cb
					C = cc
	print(val)
	print(A, B, C)


from sys import stdin, stdout
import math, bisect, heapq
from collections import Counter, deque, defaultdict
L = lambda : list(map(int, stdin.readline().strip().split()))
I = lambda : int(stdin.readline().strip())
S = lambda : stdin.readline().strip()
C = lambda : stdin.readline().strip().split()

def pr(a):
	print(' '.join(list(map(str, a))))

def solve():
	(a, b, c) = L()
	ans = 10 ** 15
	(x, y, z) = (a, b, c)
	for i in range(1, 2 * a):
		for j in range(i, 2 * b, i):
			for k in range(j, 2 * c, j):
				if abs(a - i) + abs(b - j) + abs(c - k) < ans:
					ans = abs(a - i) + abs(b - j) + abs(c - k)
					(x, y, z) = (i, j, k)
	print(ans)
	print(x, y, z)
for _ in range(I()):
	solve()


import itertools

def read_ints():
	return [int(x) for x in input().split()]
for _ in range(int(input())):
	(a, b, c) = read_ints()
	result = 60000
	answer = (-1, -1, -1)
	one = range(b, b - 10001, -1)
	two = range(b + 1, b + 20001)
	for new_b in itertools.chain(*zip(one, two, range(c, c + 20001), range(c - 1, c - 10001, -1))):
		if new_b < 1 or new_b >= 20001:
			continue
		diff_a = 10000
		diff_b = abs(b - new_b)
		if diff_b > result:
			continue
		if c % new_b < new_b - c % new_b:
			new_c = c - c % new_b
			diff_c = c % new_b
		else:
			new_c = c + new_b - c % new_b
			diff_c = new_b - c % new_b
		if diff_c + diff_b > result:
			continue
		for div_b in range(1, int(new_b ** 0.5) + 2):
			if new_b % div_b == 0:
				if abs(a - div_b) < diff_a:
					diff_a = abs(a - div_b)
					new_a = div_b
				if abs(a - new_b // div_b) < diff_a:
					diff_a = abs(a - new_b // div_b)
					new_a = new_b // div_b
		result_candidate = diff_a + diff_b + diff_c
		if result_candidate < result:
			result = result_candidate
			answer = (new_a, new_b, new_c)
	print(result)
	print(*answer)


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	m = 100000000
	(p, q, r) = (0, 0, 0)
	for i in range(1, 2 * a + 1):
		for j in range(i, 2 * b + 1, i):
			for k in range(2):
				x = j * (c // j) + k * j
				s = abs(i - a) + abs(j - b) + abs(x - c)
				if m > s:
					m = s
					p = i
					q = j
					r = x
	print(m)
	print(p, q, r)


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	ans = 10 ** 18
	cand = []
	for ta in range(1, 2 * 10 ** 4 + 1):
		for n in range(1, 2 * 10 ** 4 // ta + 1):
			tmp = abs(ta - a)
			tb = n * ta
			tmp += abs(tb - b)
			tc1 = c + (tb - c % tb)
			tc2 = c - c % tb
			if tc2 >= tb:
				if abs(tc1 - c) <= abs(tc2 - c):
					tc = tc1
				else:
					tc = tc2
			else:
				tc = tc1
			tmp += abs(tc - c)
			if tmp < ans:
				ans = tmp
				cand = [ta, tb, tc]
	print(ans)
	print(*cand)


import sys
input = sys.stdin.readline

def solve():
	(a, b, c) = map(int, input().split())
	mn = 1 << 32
	ans = None
	for a0 in range(1, 20001):
		for b0 in range(a0, 20001, a0):
			m = c % b0
			if m != c:
				if m <= b0 - m:
					c0 = c - m
				else:
					c0 = c + b0 - m
				cost = abs(a0 - a) + abs(b0 - b) + abs(c0 - c)
			else:
				c0 = c + b0 - m
				cost = abs(a0 - a) + abs(b0 - b) + abs(c0 - c)
			if cost < mn:
				mn = cost
				ans = (a0, b0, c0)
	print(mn)
	print(*ans)
for nt in range(int(input())):
	solve()


import sys
t = int(sys.stdin.readline())
for _ in range(t):
	(a, b, c) = map(int, sys.stdin.readline().split())
	ans = float('inf')
	for i in range(1, c + 1):
		for j in range(i, c + 1, i):
			if b % i == 0:
				(x, y) = (c // j, c // j + 1)
				(m, n) = (j * x, j * y)
				if m != 0 and abs(c - m) < abs(n - c):
					if abs(a - i) + abs(c - m) + abs(b - j) < ans:
						ans = abs(a - i) + abs(c - m) + abs(b - j)
						new = [i, j, m]
				elif abs(a - i) + abs(c - n) + abs(b - j) < ans:
					ans = abs(a - i) + abs(c - n) + abs(b - j)
					new = [i, j, n]
			else:
				(x, y) = (j // i, j // i + 1)
				(m, n) = (i * x, i * y)
				if m != 0:
					(p, q) = (c // m, c // m + 1)
					(g, h) = (p * m, q * m)
					if g != 0 and abs(g - c) < abs(c - h):
						if abs(g - c) + abs(m - b) + abs(i - a) < ans:
							ans = abs(g - c) + abs(m - b) + abs(i - a)
							new = [i, m, g]
					elif abs(h - c) + abs(m - b) + abs(i - a) < ans:
						ans = abs(h - c) + abs(m - b) + abs(i - a)
						new = [i, m, h]
				(p, q) = (c // n, c // n + 1)
				(g, h) = (p * n, q * n)
				if g != 0 and abs(g - c) < abs(c - h):
					if abs(g - c) + abs(n - b) + abs(i - a) < ans:
						ans = abs(g - c) + abs(n - b) + abs(i - a)
						new = [i, n, g]
				elif abs(h - c) + abs(n - b) + abs(i - a) < ans:
					ans = abs(h - c) + abs(n - b) + abs(i - a)
					new = [i, n, h]
	print(ans)
	print(*new)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = [0, 0, 0]
	m = float('inf')
	for i in range(1, 2 * a + 1):
		for j in range(i, 2 * b + 1, i):
			for k in range(j, 2 * c + 1, j):
				if m > abs(a - i) + abs(b - j) + abs(c - k):
					m = abs(a - i) + abs(b - j) + abs(c - k)
					ans = [i, j, k]
	print(m)
	print(*ans)


INF = 10 ** 10
MAX = 10 ** 4 + 32
factors = [[1] for _ in range(MAX)]
for i in range(2, MAX):
	for j in range(i, MAX, i):
		factors[j].append(i)

def main():
	print = out.append
	(a, b, c) = get_list()
	res = INF
	tri = [INF, INF, INF]
	for B in range(1, MAX):
		minq = INF
		A = INF
		for aop in factors[B]:
			if abs(a - aop) < minq:
				A = aop
				minq = abs(a - aop)
		minq = INF
		C = INF
		x = c // B
		for fac in range(x - 1, x + 2):
			if fac > 0 and abs(c - fac * B) < minq:
				C = fac * B
				minq = abs(c - fac * B)
		if abs(A - a) + abs(B - b) + abs(C - c) < res:
			res = abs(A - a) + abs(B - b) + abs(C - c)
			tri = [A, B, C]
	print(res)
	print(' '.join(map(str, tri)))
import sys
from collections import defaultdict, Counter, deque
input = iter(sys.stdin.buffer.read().decode().splitlines()).__next__
out = []
get_int = lambda : int(input())
get_list = lambda : list(map(int, input().split()))
[main() for _ in range(int(input()))]
print(*out, sep='\n')


divs = [[] for _ in range(20001)]
for i in range(1, 20001):
	j = 1
	while j * j <= i:
		if i % j == 0:
			divs[i].append(j)
			if j * j < i:
				divs[i].append(i // j)
		j += 1
t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	ans = 10 ** 5
	for i in range(1, 20001):
		res1 = 10 ** 5
		for d in divs[i]:
			if abs(d - a) < res1:
				res1 = min(res1, abs(d - a))
				x = d
		res2 = min(abs(c - i * (c // i)), abs(c - i * (c // i + 1)))
		if abs(c - i * (c // i)) < abs(c - i * (c // i + 1)):
			z = i * (c // i)
		else:
			z = i * (c // i + 1)
		if ans > res1 + res2 + abs(b - i):
			ans = res1 + res2 + abs(b - i)
			xyz = [x, i, z]
	print(ans)
	print(*xyz)


def ops(a, b, c, A, B, C):
	return round(abs(a - A) + abs(b - B) + abs(c - C))

def wanna_be_c(c, B):
	return max(round(c / B) * B, B)
div_pair = []
for i in range(1, 10001):
	j = i
	while j <= 10000:
		div_pair.append([i, j])
		j += i
	div_pair.append([i, j])
t = int(input())
for tt in range(t):
	(a, b, c) = [int(x) for x in input().split(' ')]
	sums = []
	for i in range(len(div_pair)):
		sums.append(ops(a, b, c, div_pair[i][0], div_pair[i][1], wanna_be_c(c, div_pair[i][1])))
	p = sums.index(min(sums))
	print(sums[p])
	print(div_pair[p][0], div_pair[p][1], wanna_be_c(c, div_pair[p][1]), sep=' ')


import string
from collections import defaultdict, Counter
from math import sqrt, log10, log2, log, gcd, ceil, floor, factorial
from bisect import bisect_left, bisect_right
from itertools import permutations, combinations_with_replacement
import sys, io, os
input = sys.stdin.readline
sys.setrecursionlimit(10000)
mod = int(pow(10, 7) + 9)
inf = float('inf')

def get_list():
	return [int(i) for i in input().split()]

def yn(a):
	print('YES' if a else 'NO')
n = 20000
l = []
m = [[]]
mrev = [[] for i in range(n + 1)]
for i in range(1, n + 1):
	m.append([])
	for j in range(i, n + 1, i):
		m[-1].append(j)
		mrev[j].append(i)
		l.append([i, j])
t = 1
t = int(input())

def update(a, b, c, i, j, k):
	return abs(i - a) + abs(j - b) + abs(k - c)
for _ in range(t):
	(a, b, c) = get_list()
	if c % b == 0 and b % a == 0:
		print(0)
		print(a, b, c)
		continue
	mina = inf
	ans = [a, b, c]
	for iter in l:
		i = iter[0]
		j = iter[1]
		k = c // j * j
		if k < j:
			k = j
		version = update(a, b, c, i, j, k)
		if version < mina:
			mina = version
			answer = [i, j, k]
		k += j
		version = update(a, b, c, i, j, k)
		if version < mina:
			mina = version
			answer = [i, j, k]
	print(mina)
	print(*answer)


from math import ceil
import sys
input = sys.stdin.readline
for i in range(int(input())):
	(a, b, c) = map(int, input().split())
	MIN = float('inf')
	for i in range(1, 11000):
		for j in range(i, 11000, i):
			newc1 = c // j * j
			newc2 = ceil(c / j) * j
			y1 = abs(a - i) + abs(b - j) + abs(c - newc1)
			y2 = abs(a - i) + abs(b - j) + abs(c - newc2)
			if y1 < MIN:
				MIN = y1
				(a1, b1, c1) = (i, j, newc1)
			if y2 < MIN:
				MIN = y2
				(a1, b1, c1) = (i, j, newc2)
	print(MIN)
	print(a1, b1, c1)


def solve(a, b, c):
	mx = a + b - 2
	best = mx
	bestv = (1, 1, c)
	for aa in range(1, 2 * a):
		for bb in range(aa, 2 * b, aa):
			cc = bb
			for ccc in (c // bb * bb, (c + bb - 1) // bb * bb):
				if abs(cc - c) > abs(ccc - c):
					cc = ccc
			cur = abs(a - aa) + abs(b - bb) + abs(c - cc)
			if cur < best:
				best = cur
				bestv = (aa, bb, cc)
	return (best, bestv)
t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	(r, x) = solve(a, b, c)
	print(r)
	print(*x)


t = int(input())
ans = []
for _ in range(t):
	(a, b, c) = map(int, input().split())
	out = 10 ** 9
	out_l = [a, b, c]
	for A in range(1, 2 * a):
		B = A
		while B <= 2 * b:
			C = int(c / B) * B
			cost = abs(a - A) + abs(b - B) + abs(c - C)
			if cost < out:
				out = cost
				out_l = [A, B, C]
			cost = abs(a - A) + abs(b - B) + abs(c - (C + B))
			if cost < out:
				out = cost
				out_l = [A, B, C + B]
			B += A
	ans.append(str(out))
	ans.append(' '.join(list(map(str, out_l))))
print('\n'.join(ans))


mii = 3 * 10 ** 4
factors = [set() for _ in range(mii + 1)]
factors[1] = set([1])
for k in range(2, mii + 1):
	for p in range(2, mii + 1):
		if k % p == 0:
			factors[k] = set((ole * p for ole in factors[k // p])) | factors[k // p]
			break
		elif p * p > k:
			factors[k] = set([1, k])
			break
t = int(input())
for _ in range(t):
	(a, b, c) = [int(x) for x in input().split()]
	best_score = 10 ** 15
	best_trip = (a, b, c)
	for k in range(1, mii + 1):
		this_b = k
		if c % this_b < this_b - c % this_b:
			this_c = this_b * (c // this_b)
		else:
			this_c = this_b * (c // this_b + 1)
		this_c = max(this_c, this_b)
		this_a = -1
		loss_a = 10 ** 15
		for cur_a in factors[this_b]:
			if abs(a - cur_a) < loss_a:
				this_a = cur_a
				loss_a = abs(a - cur_a)
		cur_score = abs(a - this_a) + abs(b - this_b) + abs(c - this_c)
		if cur_score < best_score:
			best_score = cur_score
			best_trip = (this_a, this_b, this_c)
	print(best_score)
	print(*best_trip)


MAX = 15000
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = float('inf')
	(aa, bb, cc) = (0, 0, 0)
	for xa in range(1, MAX + 1):
		for xb in range(xa, MAX + 1, xa):
			for xc in range(xb, MAX + 1, xb):
				if abs(a - xa) + abs(b - xb) + abs(c - xc) < ans:
					ans = abs(a - xa) + abs(b - xb) + abs(c - xc)
					(aa, bb, cc) = (xa, xb, xc)
	print(ans)
	print(aa, bb, cc)


from sys import stdin

def find_closest(x, y):
	first = int(y / x) * x
	second = first + x
	if abs(first - y) > abs(second - y):
		return (abs(second - y), second)
	else:
		return (abs(first - y), first)
t = int(stdin.readline())
for i in range(t):
	(a, b, c) = list(map(int, stdin.readline().split(' ')))
	A = -1
	B = -1
	C = -1
	ans = 1000000000
	for cA in range(1, 2 * a + 1):
		for cB in range(cA, 2 * b + 1, cA):
			(res, cC) = find_closest(cB, c)
			if res + abs(cA - a) + abs(cB - b) < ans:
				ans = res + abs(cA - a) + abs(cB - b)
				A = cA
				B = cB
				C = cC
	print(str(ans))
	print(str(A) + ' ' + str(B) + ' ' + str(C))


import math
import sys
from collections import defaultdict, Counter
from itertools import groupby
rt = lambda : map(int, input().split())
ri = lambda : int(input())
rl = lambda : list(map(int, input().split()))

def main():
	t = ri()
	for _ in range(t):
		(a, b, c) = rt()
		res = math.inf
		(A, B, C) = (-1, -1, -1)
		for i in range(1, 2 * a + 1):
			ma = 1
			while i * ma <= 2 * b:
				c_cand1 = c // (i * ma) * (i * ma)
				c_cand2 = c // (i * ma) * (i * ma) + i * ma
				c_cand = c_cand1
				if c_cand1 < i * ma or (c_cand2 >= i * ma and abs(c - c_cand2) < abs(c - c_cand1)):
					c_cand = c_cand2
				if abs(i - a) + abs(i * ma - b) + abs(c_cand - c) < res:
					res = abs(i - a) + abs(i * ma - b) + abs(c_cand - c)
					(A, B, C) = (i, i * ma, c_cand)
				ma += 1
		print(res)
		print(A, B, C)
main()


for o in range(int(input())):
	(a, b, c) = map(int, input().split())
	A = B = C = -1
	result = 10 ** 9
	for a_i in range(1, 2 * a + 1):
		for b_i in range(a_i, 2 * b + 1, a_i):
			for k in range(0, 2):
				c_i = b_i * (c // b_i) + k * b_i
				count = abs(a_i - a) + abs(b_i - b) + abs(c_i - c)
				if result > count:
					result = count
					A = a_i
					B = b_i
					C = c_i
	print(result)
	print(A, B, C)


import sys
import math
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	if b % a == 0 and c % b == 0:
		print(0)
		print(a, b, c)
		continue
	ans = 1000000
	N = 10100
	p = []
	for i in range(a, N):
		t1 = i - a
		y = i
		while y < N:
			t2 = abs(y - b)
			z = y
			q3 = abs(z - c)
			while z < N:
				t3 = abs(z - c)
				if t1 + t2 + t3 < ans:
					ans = t1 + t2 + t3
					p = [i, y, z]
				if t3 > q3:
					break
				q3 = abs(z - c)
				z += y
			y += i
	for i in range(a, 0, -1):
		t1 = a - i
		y = i
		while y < N:
			t2 = abs(y - b)
			z = y
			q3 = abs(z - c)
			while z < N:
				t3 = abs(z - c)
				if t1 + t2 + t3 < ans:
					ans = t1 + t2 + t3
					p = [i, y, z]
				if t3 > q3:
					break
				q3 = abs(z - c)
				z += y
			y += i
	print(ans)
	print(*p)


for _ in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	ans = None
	dist = 10000000000.0
	for i in range(1, 2 * a + 1):
		for j in range(i, 2 * b + 1, i):
			for k in range(j, 2 * c + 1, j):
				if abs(a - i) + abs(b - j) + abs(c - k) < dist:
					ans = [i, j, k]
					dist = abs(a - i) + abs(b - j) + abs(c - k)
	print(dist)
	print(*ans)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	n = 10 ** 4 + 101
	mn = float('inf')
	for na in range(1, n):
		x = 1
		while na * x <= n:
			nb = x * na
			y = 1
			while nb * y <= n:
				nc = y * nb
				v = abs(na - a) + abs(nb - b) + abs(nc - c)
				if v < mn:
					mn = v
					ans = [na, nb, nc]
				y += 1
			x += 1
	print(mn)
	print(*ans)


t = int(input())
while t:
	(a, b, c) = map(int, input().split())
	ans = [-1, -1, -1]
	mi = 100000000000
	for i in range(1, 2 * a + 1):
		ai = i
		bi = ai
		while bi <= 2 * b:
			ci = c // bi * bi
			if ci >= bi:
				m = abs(a - ai) + abs(b - bi) + abs(c - ci)
				if mi > m:
					mi = m
					ans = [ai, bi, ci]
			ci = c // bi * bi + bi
			if ci >= bi:
				m = abs(a - ai) + abs(b - bi) + abs(c - ci)
				if mi > m:
					mi = m
					ans = [ai, bi, ci]
			bi = bi + ai
	print(mi)
	print(*ans)
	t -= 1


def getAllFactors(x):
	factors = []
	for i in range(1, int(x ** 0.5) + 1):
		if x % i == 0:
			factors.append(i)
			if x // i != i:
				factors.append(x // i)
	return sorted(factors)
factors = [None for _ in range(20001)]
for x in range(1, 20001):
	factors[x] = getAllFactors(x)

def main():
	allans = []
	t = int(input())
	for _ in range(t):
		(a, b, c) = readIntArr()
		ansDiff = inf
		ans = [None, None, None]
		for bb in range(1, 20001):
			facs = factors[bb]
			m = len(facs)
			i = -1
			zz = m
			aa = inf
			while zz > 0:
				while i + zz < m and facs[i + zz] < a:
					i += zz
				zz //= 2
			if 0 <= i < m:
				if abs(a - facs[i]) < abs(a - aa):
					aa = facs[i]
			if 0 <= i + 1 < m:
				if abs(a - facs[i + 1]) < abs(a - aa):
					aa = facs[i + 1]
			k = max(1, c // bb)
			cc = inf
			if abs(k * bb - c) < abs(cc - c):
				cc = k * bb
			if abs((k + 1) * bb - c) < abs(cc - c):
				cc = (k + 1) * bb
			diff = abs(a - aa) + abs(b - bb) + abs(c - cc)
			if diff < ansDiff:
				ansDiff = diff
				ans = [aa, bb, cc]
		allans.append([ansDiff])
		allans.append(ans)
	multiLineArrayOfArraysPrint(allans)
	return
import sys
input = sys.stdin.buffer.readline

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]
inf = float('inf')
MOD = 10 ** 9 + 7
main()


def solve():
	(a, b, c) = [int(s) for s in input().strip().split()]
	minstep = float('inf')
	result = (a, b, c)
	for A in range(1, 2 * a):
		for B in range(A, 2 * b, A):
			for C in [c // B * B, c // B * B + B]:
				if C >= B:
					step = abs(a - A) + abs(b - B) + abs(c - C)
					if step < minstep:
						minstep = step
						result = (A, B, C)
	print(minstep)
	print(*result)

def main():
	for _ in range(int(input().strip())):
		solve()
main()


import math
maxx = 15000
for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	xa = xb = xc = 0
	ans = math.inf
	for i in range(1, maxx + 1):
		for j in range(i, maxx + 1, i):
			for k in range(j, maxx + 1, j):
				if abs(a - i) + abs(b - j) + abs(c - k) < ans:
					ans = abs(a - i) + abs(b - j) + abs(c - k)
					(xa, xb, xc) = (i, j, k)
	print(ans)
	print(xa, xb, xc)


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

def I():
	return int(input())

def S():
	return str(input())

def L():
	return list(R())
from collections import Counter
import math
import sys
from itertools import permutations
import bisect
div = [0] * 30001
for i in range(1, 30001):
	div[i] = []
for i in range(1, 30001):
	for j in range(1, 30000 // i + 1):
		div[i * j].append(i)
for _ in range(I()):
	(a, b, c) = R()
	f_ans = math.inf
	for b2 in range(1, 3 * c):
		c2 = [c - c % b2, c + b2 - c % b2]
		ind = bisect.bisect(div[b2], a)
		l = len(div[b2])
		a2 = [div[b2][min(ind, l - 1)], div[b2][max(0, ind - 1)]]
		for i in range(2):
			for j in range(2):
				if abs(a - a2[i]) + abs(c - c2[j]) + abs(b - b2) < f_ans:
					f_ans = abs(a - a2[i]) + abs(c - c2[j]) + abs(b - b2)
					a3 = a2[i]
					b3 = b2
					c3 = c2[j]
	print(f_ans)
	print(a3, b3, c3)


import sys
import os
import time
import collections
from collections import Counter, deque
import itertools
import math
import timeit
import random
from io import BytesIO, IOBase
from bisect import bisect_left

def sieve(n):
	if n < 2:
		return list()
	prime = [True for _ in range(n + 1)]
	p = 3
	while p * p <= n:
		if prime[p]:
			for i in range(p * 2, n + 1, p):
				prime[i] = False
		p += 2
	r = [2]
	for p in range(3, n + 1, 2):
		if prime[p]:
			r.append(p)
	return r

def divs(n, start=1):
	divisors = []
	for i in range(start, int(math.sqrt(n) + 1)):
		if n % i == 0:
			if n / i == i:
				divisors.append(i)
			else:
				divisors.extend([i, n // i])
	return divisors

def divn(n, primes):
	divs_number = 1
	for i in primes:
		if n == 1:
			return divs_number
		t = 1
		while n % i == 0:
			t += 1
			n //= i
		divs_number *= t

def flin(d, x, default=-1):
	left = right = -1
	for i in range(len(d)):
		if d[i] == x:
			if left == -1:
				left = i
			right = i
	if left == -1:
		return (default, default)
	else:
		return (left, right)

def ceil(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 prr(a, sep=' '):
	print(sep.join(map(str, a)))

def dd():
	return collections.defaultdict(int)

def ddl():
	return collections.defaultdict(list)
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')
for _ in range(ii()):
	(a, b, c) = mi()
	mn = 10 ** 6
	for tmpa in range(1, 2 * a):
		for tmpb in range(tmpa, 2 * b, tmpa):
			for k in range(2):
				tmpc = c // tmpb * tmpb + k * tmpb
				res = abs(a - tmpa) + abs(b - tmpb) + abs(c - tmpc)
				if res < mn:
					mn = res
					A = tmpa
					B = tmpb
					C = tmpc
	print(mn)
	print(A, B, C)


import io
import os
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
import math
t = int(input())
for tc in range(t):
	(a, b, c) = map(int, input().split())
	moves = 10 ** 10
	(anew, bnew, cnew) = (0, 0, 0)
	for i in range(1, 4 * a):
		for j in range(i, 4 * b, i):
			possiblec1 = c // j * j
			possiblec2 = (c // j + 1) * j
			movereq1 = abs(a - i) + abs(b - j) + abs(c - possiblec1)
			movereq2 = abs(a - i) + abs(b - j) + abs(c - possiblec2)
			if movereq1 < moves:
				moves = movereq1
				anew = i
				bnew = j
				cnew = possiblec1
			if movereq2 < moves:
				moves = movereq2
				anew = i
				bnew = j
				cnew = possiblec2
	print(moves)
	print(anew, bnew, cnew)


for _ in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	ans = 71227122
	abc = []
	for A in range(1, 10001, 1):
		for B in range(A, 20001, A):
			for C in [c // B * B, (c // B + 1) * B]:
				if C < B:
					C = B
				diff = abs(A - a) + abs(B - b) + abs(C - c)
				if diff < ans:
					ans = diff
					abc = [A, B, C]
	print(ans)
	print(*abc)


from collections import Counter
from collections import defaultdict
import math
t = int(input())
for _ in range(0, t):
	(a, b, c) = list(map(int, input().split()))
	i = 1
	ans = 9999999
	pairs = [0, 0, 0]
	while i < 12000:
		j = i
		while j < 12000:
			k = j
			while k < 12000:
				diff = abs(a - i) + abs(b - j) + abs(c - k)
				if diff < ans:
					ans = diff
					pairs = [i, j, k]
				k = k + j
			j = j + i
		i = i + 1
	print(ans)
	print(*pairs)


for test in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 1000000000.0
	for ca in range(1, 2 * a + 1):
		for cb in range(ca, 2 * b + 1, ca):
			for i in range(0, 2):
				cc = cb * (c // cb) + i * cb
				res = abs(ca - a) + abs(cb - b) + abs(cc - c)
				if ans > res:
					ans = res
					A = ca
					B = cb
					C = cc
	print(ans)
	print(A, B, C)


import sys
input = sys.stdin.readline
for _ in range(int(input())):
	(a, b, c) = list(map(int, input().split()))
	ans = 10 ** 18
	index = [0, 0, 0]
	for x in range(1, c + 1):
		for y in range(x, c + 100, x):
			cost = abs(a - x) + abs(b - y)
			if c % y < y - c % y:
				z = c - c % y
				cost += c % y
			else:
				z = c + (y - c % y)
				cost += y - c % y
			if ans > cost:
				ans = cost
				index = [x, y, z]
	print(ans)
	print(*index)


import sys
input = sys.stdin.readline
Q = int(input())
Query = [list(map(int, input().split())) for _ in range(Q)]
for (A, B, C) in Query:
	ans = 10 ** 15
	for a in range(1, C + 1):
		m = 1
		while True:
			b = m * a
			k = C // b
			c = k * b
			if abs(c - C) > abs((k + 1) * b - C):
				c = (k + 1) * b
			tmp = abs(a - A) + abs(b - B) + abs(c - C)
			if tmp < ans:
				ans = tmp
				E = [a, b, c]
			if b > C:
				break
			m += 1
	print(ans)
	print(*E)


t = int(input().strip())
for _ in range(t):
	(a, b, c) = list(map(int, input().strip().split()))
	min_val = float('inf')
	min_order = [a, b, c]
	for A in range(1, 2 * a):
		B = A
		while B < 2 * b:
			for C in [c // B * B, c // B * B + B]:
				if B <= C:
					val = abs(A - a) + abs(B - b) + abs(C - c)
					if val <= min_val:
						min_val = val
						min_order = [A, B, C]
			B += A
	print(min_val)
	print(*min_order)


for t in range(int(input())):
	(a, b, c) = map(int, input().split())
	(mini, count) = (999999, 0)
	(x, y, z, flag) = (0, 0, 0, 0)
	for i in range(1, 2 * a + 1):
		(count, flag) = (0, 0)
		j = i
		while j <= 2 * b:
			count = abs(a - i)
			count += abs(b - j)
			if c % j < j - c % j:
				count += c % j
				flag = 1
			else:
				count += j - c % j
				flag = 2
			if count < mini:
				mini = count
				if flag == 1:
					(x, y, z) = (i, j, j * (c // j))
				else:
					(x, y, z) = (i, j, j * (c // j + 1))
			j += i
	print(mini)
	print(x, y, z)


import sys
input = sys.stdin.readline
yaku = [set([]) for i in range(20001)]
yaku[1].add(1)
for i in range(2, 20001):
	for j in range(1, round(i ** 0.5) + 1):
		if i % j == 0:
			yaku[i].add(i // j)
			yaku[i].add(j)
t = int(input())
for ii in range(t):
	(a, b, c) = map(int, input().split())
	kai = 10 ** 10
	ans = [a, b, c]
	for i in range(1, 20001):
		k = abs(b - i)
		an = [i]
		g = c % i
		if g > i - g:
			k += i - g
			an = an + [c + i - g]
		else:
			k += g
			an = an + [c - g]
		p = 10 ** 10
		a1 = 0
		for j in yaku[i]:
			if p > abs(a - j):
				a1 = j
				p = abs(a - j)
		k += abs(a - a1)
		an = [a1] + an
		if kai > k and an[0] <= an[1] <= an[2]:
			kai = k
			ans = an
	print(kai)
	print(*ans)


import sys

def minp():
	return sys.stdin.readline().strip()

def mint():
	return int(minp())

def mints():
	return map(int, minp().split())
MAXN = 20021
f = [[] for i in range(MAXN)]
sieve = [0] * MAXN
for i in range(2, MAXN):
	if i * i > MAXN:
		break
	if sieve[i] == 0:
		for j in range(i * i, MAXN, i):
			if sieve[j] == 0:
				sieve[j] = i

def divisors(pos, x):
	global p
	if pos == len(p):
		d.append(x)
		return
	(m, n) = p[pos]
	for i in range(n + 1):
		divisors(pos + 1, x)
		x *= m
f[1] = [1]
for i in range(2, 20021):
	j = i
	a = []
	while sieve[j] != 0:
		x = sieve[j]
		a.append(x)
		j //= x
	a.append(j)
	j = 0
	p = []
	while j < len(a):
		k = j + 1
		while k < len(a) and a[j] == a[k]:
			k += 1
		p.append((a[j], k - j))
		j = k
	d = []
	divisors(0, 1)
	f[i] = d

def solve():
	(a, b, c) = mints()
	ans = (int(1000000000.0), 0, 0, 0)
	for C in range(1, 2 * c + 10):
		dc = abs(C - c)
		for B in f[C]:
			db = abs(B - b)
			for A in f[B]:
				ans = min(ans, (dc + db + abs(A - a), A, B, C))
	print(ans[0])
	print(*ans[1:])
for i in range(mint()):
	solve()


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	a1 = a2 = a3 = 0
	cabs = 99999999
	for i in range(1, 11000):
		for j in range(i, 11000, i):
			for k in range(j, 11000, j):
				bs = abs(i - a) + abs(b - j) + abs(c - k)
				if bs < cabs:
					(a1, a2, a3) = (i, j, k)
					cabs = bs
	print(cabs, '\n', a1, a2, a3)


import sys
from collections import defaultdict
from itertools import permutations, combinations
import string
from heapq import heapify, heappush, heappop

def solve():
	alphabets = string.ascii_lowercase
	digits = string.digits
	get_arr = lambda type_=int: list(map(type_, sys.stdin.readline().rstrip('\n').split()))
	inp = lambda type_=int: type_(sys.stdin.readline().rstrip('\n'))
	pair = lambda type_=int: map(type_, sys.stdin.readline().rstrip('\n').split(' '))
	t = inp()
	pairs = []
	for a in range(1, int(10000.0) + 100):
		for b in range(a, int(10000.0) + a, a):
			for c in range(b, int(10000.0) + b, b):
				pairs.append((a, b, c))
	for _ in range(t):
		(a, b, c) = get_arr()
		m = float('inf')
		minpair = (0, 0, 0)
		for (a1, b1, c1) in pairs:
			res = abs(a1 - a) + abs(b1 - b) + abs(c1 - c)
			if res < m:
				m = res
				minpair = (a1, b1, c1)
		print(m)
		print(minpair[0], minpair[1], minpair[2])
solve()


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 10 ** 12
	(A, B, C) = (a, b, c)
	for i in range(1, 2 * a + 1):
		for j in range(i, 2 * b + 1, i):
			if c <= j:
				k = j
			elif c > j:
				if c % j < j - c % j:
					k = c - c % j
				else:
					k = c + j - c % j
			s = abs(i - a) + abs(j - b) + abs(k - c)
			if ans > s:
				ans = s
				(A, B, C) = (i, j, k)
	print(ans)
	print(A, B, C)


def main():
	(a, b, c) = map(int, input().split())
	(A, B, C) = (-1, -1, -1)
	ans = 1000000000.0
	for i in range(1, 2 * a + 1):
		for j in range(i, 2 * b + 1, i):
			for k in range(2):
				cC = j * (c // j) + k * j
				res = abs(a - i) + abs(b - j) + abs(c - cC)
				if ans > res:
					ans = res
					A = i
					B = j
					C = cC
	print(ans)
	print(A, B, C)
	return

def test():
	t = int(input())
	while t:
		main()
		t -= 1
test()


def solve():
	(a, b, c) = map(int, input().split())
	A = B = C = -1
	ans = 1000000000.0
	cA = 1
	while cA <= 2 * a:
		cB = cA
		while cB <= 2 * b:
			for i in range(2):
				cC = cB * (c // cB) + i * cB
				res = abs(cA - a) + abs(cB - b) + abs(cC - c)
				if ans > res:
					ans = res
					A = cA
					B = cB
					C = cC
			cB += cA
		cA += 1
	print(ans)
	print(A, B, C)
for _ in range(int(input())):
	solve()


import os
import sys
from io import BytesIO, IOBase
import threading
from math import cos, sin, pi
mod = 998244353

def main():
	for _ in range(int(input())):
		(a, b, c) = map(int, input().split())
		ans = float('inf')
		p = -1
		for a_ in range(1, 2 * a + 1):
			cost = abs(a - a_)
			for d in range(1, 2 * b // a_ + 1):
				b_ = a_ * d
				cost += abs(b - b_)
				for d_ in range(-1, 2):
					c_ = b_ * (c // b_ + d_ if b_ > 0 else -100)
					cost += abs(c - c_)
					if cost < ans and a_ > 0 and (b_ > 0) and (c_ >= b_):
						ans = cost
						p = (a_, b_, c_)
					cost -= abs(c - c_)
				cost -= abs(b - b_)
		print(ans)
		print(*p)
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')
main()


import sys

def input():
	return sys.stdin.readline().rstrip('\r\n')
for cas in range(int(input())):
	(a, b, c) = map(int, input().split())
	ans = 1061109567
	for i in range(1, c + 1):
		for times in range(1, int(20000.0 + 5)):
			j = i * times
			if j > int(20000.0):
				break
			cur = abs(i - a) + abs(j - b) + min(c % j, j - c % j)
			if cur < ans:
				ans = cur
				(A, B) = (i, j)
				C = c - c % j if c % j <= j - c % j else c + j - c % j
			ans = min(ans, cur)
	print(ans)
	print(A, B, C)


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	ans = 100000
	(x, y, z) = (0, 0, 0)
	for i in range(1, 11000):
		for j in range(i, 11000, i):
			for k in [c // j * j, c // j * j + j]:
				if ans > abs(a - i) + abs(b - j) + abs(c - k):
					ans = abs(a - i) + abs(b - j) + abs(c - k)
					(x, y, z) = (i, j, k)
	print(ans)
	print(x, y, z)


testcase = int(input())
for i in range(testcase):
	(a, b, c) = map(int, input().split())
	ans = 10 ** 12
	for ca in range(1, 2 * a, 1):
		for cb in range(ca, 2 * b, ca):
			for k in range(2):
				cc = cb * (c // cb) + k * cb
				res = abs(ca - a) + abs(cb - b) + abs(c - cc)
				if ans > res:
					ans = res
					A = ca
					B = cb
					C = cc
	print(ans)
	print(A, B, C)


from sys import stdin
input = stdin.buffer.readline
last = []
for _ in range(int(input())):
	t = int(1000000000.0)
	(A, B, C) = map(int, input().split())
	for a in range(1, 10001):
		for b in range(a, 20001, a):
			c = C // b * b
			c = c if abs(c - C) < abs(c + b - C) else c + b
			x = abs(a - A) + abs(b - B) + abs(c - C)
			if x < t:
				t = x
				(u, v, w) = (a, b, c)
	last.append(str(t))
	last.append(' '.join([str(u), str(v), str(w)]))
print('\n'.join(last))


import sys
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
except:
	pass
input = sys.stdin.readline
for tt in range(int(input())):
	(a, b, c) = map(int, input().split())
	m = float('inf')
	for i in range(1, 10000 + 100):
		for j in range(i, 10000 + 100, i):
			for k in range(j, 10000 + 100, j):
				diff = abs(a - i) + abs(b - j) + abs(c - k)
				if diff < m:
					ca = i
					cb = j
					cc = k
					m = diff
	print(m)
	print(ca, cb, cc)


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	cnt = 99999999999999999999999999999999999999999
	ans = [0, 0, 0]
	for i in range(1, 15000 + 1):
		s = abs(i - a)
		temp = s
		j = i * 1
		o = 1
		while j <= 15000:
			temp += abs(j - b)
			f = c // j
			(l, h) = (f * j, (f + 1) * j)
			kk = h
			if abs(l - c) < abs(h - c):
				kk = l
			temp += abs(kk - c)
			if temp < cnt:
				cnt = temp
				ans[0] = i
				ans[1] = j
				ans[2] = kk
			temp = s
			o += 1
			j = i * o
	print(cnt)
	print(' '.join(map(str, ans)))


def main():
	t = int(input())
	allans = []
	for _ in range(t):
		(a, b, c) = readIntArr()
		maxDiff = a - 1 + b - 1
		diff = inf
		ans = [None, None, None]
		aa = 1
		while True:
			aChange = abs(aa - a)
			if aChange > maxDiff:
				break
			bb = max(aa, aChange + b - maxDiff)
			k = (bb + aa - 1) // aa
			bb = k * aa
			while True:
				bChange = abs(bb - b)
				if aChange + bChange > maxDiff:
					break
				k = c // bb
				k = max(1, k)
				cc1 = k * bb
				cc2 = (k + 1) * bb
				cChange1 = abs(cc1 - c)
				cChange2 = abs(cc2 - c)
				if cChange1 < cChange2:
					cc = cc1
					cChange = cChange1
				else:
					cc = cc2
					cChange = cChange2
				if aChange + bChange + cChange < diff:
					diff = aChange + bChange + cChange
					ans = [aa, bb, cc]
				bb += aa
			aa += 1
		allans.append([diff])
		allans.append(ans)
	multiLineArrayOfArraysPrint(allans)
	return
import sys
input = sys.stdin.buffer.readline

def oneLineArrayPrint(arr):
	print(' '.join([str(x) for x in arr]))

def multiLineArrayPrint(arr):
	print('\n'.join([str(x) for x in arr]))

def multiLineArrayOfArraysPrint(arr):
	print('\n'.join([' '.join([str(x) for x in y]) for y in arr]))

def readIntArr():
	return [int(x) for x in input().split()]
inf = float('inf')
MOD = 10 ** 9 + 7
main()


import io
import os
from collections import Counter, defaultdict, deque

def solve(A, B, C):

	def cost(a, b, c):
		return abs(A - a) + abs(B - b) + abs(C - c)
	best = (cost(1, 1, 1), (1, 1, 1))
	for a in range(1, 2 * A + 1):
		for b in range(a, 2 * B + 1, a):
			for c in [b * (C // b), b * (C // b) + b]:
				best = min(best, (cost(a, b, c), (a, b, c)))
	(bestCost, bestSol) = best
	return str(bestCost) + '\n' + ' '.join(map(str, bestSol))
input = io.BytesIO(os.read(0, os.fstat(0).st_size)).readline
T = int(input())
for t in range(T):
	(A, B, C) = [int(x) for x in input().split()]
	ans = solve(A, B, C)
	print(ans)


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	A = B = C = 1
	ans = a + b + c - 3
	nums = [1, 1, 1]
	for i in range(1, 2 * a + 1):
		for j in range(i, 2 * b + 1, i):
			for k in range(2):
				temp = (c // j + k) * j
				if temp >= j:
					diff = abs(a - i) + abs(b - j) + abs(c - temp)
					if diff < ans:
						ans = diff
						(A, B, C) = (i, j, temp)
	print(ans)
	print(A, B, C)


import math
import time

def generate_div(num):
	r = math.ceil(math.sqrt(num))
	for i in range(1, r + 1):
		if num % i == 0:
			yield i
			if num / i != i:
				yield int(num / i)

def solve():
	t = int(input())
	while t > 0:
		(A, B, C) = map(int, input().split())
		result = [1, 1, C]
		f_range = A - 1 + (B - 1)
		if C - A + (C - B) < f_range:
			f_range = C - A + (C - B)
			result = [C, C, C]
		max_C = C + f_range
		min_C = C - f_range
		ans = f_range
		for i in range(min_C, max_C + 1):
			cur_ans = abs(C - i)
			if cur_ans > ans:
				continue
			for new_B in generate_div(i):
				cur_ans += abs(B - new_B)
				if cur_ans > ans:
					cur_ans = abs(C - i)
					continue
				cur_new_A = 1
				mn_diff = abs(A - 1)
				for new_A in generate_div(new_B):
					diff = abs(new_A - A)
					if diff < mn_diff:
						mn_diff = diff
						cur_new_A = new_A
				cur_ans += abs(cur_new_A - A)
				if cur_ans < ans:
					ans = cur_ans
					result = [cur_new_A, new_B, i]
				cur_ans = abs(C - i)
		print(ans)
		print(result[0], result[1], result[2])
		t -= 1
solve()


from math import sqrt
t = int(input())

def verify(a, b, c):
	if a == 0 or b == 0:
		return False
	return c % b == b % a == 0
for _ in range(t):
	(a, b, c) = map(int, input().split())
	bs = [0] * 20000
	for bi in range(1, 20001):
		ci = c // bi * bi
		cdist = min(c - ci, ci + bi - c)
		bdist = abs(b - bi)
		bs[bi - 1] = cdist + bdist
	bestPos = 30000
	bestPosAi = -1
	bestPosBi = -1
	for ai in range(1, 20001):
		for bi in range(ai, 20001, ai):
			adist = abs(a - ai)
			bValue = bs[bi - 1]
			if adist + bValue < bestPos:
				bestPos = adist + bValue
				bestPosAi = ai
				bestPosBi = bi
	print(bestPos)
	bestPosCiL = c // bestPosBi * bestPosBi
	if c - bestPosCiL > bestPosCiL + bestPosBi - c:
		bestPosCiL = bestPosCiL + bestPosBi
	print(bestPosAi, bestPosBi, bestPosCiL)


import sys
from functools import lru_cache, cmp_to_key
from heapq import merge, heapify, heappop, heappush
from math import *
from collections import defaultdict as dd, deque, Counter as C
from itertools import combinations as comb, permutations as perm
from bisect import bisect_left as bl, bisect_right as br, bisect
from time import perf_counter
from fractions import Fraction
mod = int(pow(10, 9) + 7)
mod2 = 998244353

def data():
	return sys.stdin.readline().strip()

def out(*var, end='\n'):
	sys.stdout.write(' '.join(map(str, var)) + end)

def L():
	return list(sp())

def sl():
	return list(ssp())

def sp():
	return map(int, data().split())

def ssp():
	return map(str, data().split())

def l1d(n, val=0):
	return [val for i in range(n)]

def l2d(n, m, val=0):
	return [l1d(n, val) for j in range(m)]
try:
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('../output.txt', 'w')
except:
	pass
for _ in range(L()[0]):
	(a, b, c) = L()
	mn = 10 ** 10
	for i in range(1, 2 * a + 1):
		for j in range(i, 2 * b, i):
			c1 = c // j * j
			c2 = c1 + j
			cost = abs(a - i) + abs(b - j) + min(abs(c - c1), abs(c - c2))
			if cost < mn:
				mn = cost
				x = [i, j]
				if abs(c - c1) < abs(c - c2):
					x.append(c1)
				else:
					x.append(c2)
	print(mn)
	print(*x)


t = int(input())
for _ in range(t):
	(a, b, c) = map(int, input().split())
	ans = [0, 0, 0]
	m = 9999999999
	for i in range(1, 10500):
		for j in range(i, 10500, i):
			for k in range(j, 10500, j):
				if m > abs(a - i) + abs(b - j) + abs(c - k):
					m = abs(a - i) + abs(b - j) + abs(c - k)
					ans = [i, j, k]
	print(m)
	print(*ans)


from sys import stdin, stdout
import math
import heapq
t = 1

def aint():
	return int(input().strip())

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

def fint():
	return list(map(int, stdin.readline().split()))

def main():
	(a, b, c) = lint()
	ans = int(1000000000000.0)
	(aa, bb, cc) = (None, None, None)
	for A in range(1, 10001):
		for B in range(A, 20001, A):
			curr = abs(A - a) + abs(B - b)
			if c <= B:
				curr += B - c
				C = B
			else:
				C = c // B * B
				Cd = C + B
				if c - C > Cd - c:
					C = Cd
					curr += Cd - c
				else:
					curr += c - C
			if curr < ans:
				ans = curr
				aa = A
				bb = B
				cc = C
	print(ans)
	print(aa, bb, cc)
t = int(input())
for i in range(t):
	main()


import bisect
MAX_N = int(2 * 10000.0 + 10)
divisors = [[1] for _ in range(MAX_N)]
for factor in range(2, MAX_N):
	multiple = factor
	while multiple < MAX_N:
		divisors[multiple].append(factor)
		multiple += factor
t = int(input())
for _ in range(t):
	(a, b, c) = tuple(map(int, input().split()))
	min_value = 987654321
	A_saved = B_saved = C_saved = 0
	for B in range(1, MAX_N):
		temp = bisect.bisect_left(divisors[B], a)
		if temp == 0:
			A = 1
		elif temp >= len(divisors[B]):
			A = divisors[B][-1]
		elif abs(a - divisors[B][temp - 1]) < abs(a - divisors[B][temp]):
			A = divisors[B][temp - 1]
		else:
			A = divisors[B][temp]
		C = round(c / B) * B
		value = abs(a - A) + abs(b - B) + abs(c - C)
		if value < min_value:
			min_value = value
			A_saved = A
			B_saved = B
			C_saved = C
	print(min_value)
	print('{} {} {}'.format(A_saved, B_saved, C_saved))


t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	ans = float('inf')
	output = [a, b, c]
	for pA in range(1, 2 * a + 1):
		for pB in range(pA, b * 2 + 1, pA):
			pC = pB * int(c / pB)
			if pB <= pC:
				res = abs(pA - a) + abs(pB - b) + abs(pC - c)
				if res < ans:
					ans = res
					(output[0], output[1], output[2]) = (pA, pB, pC)
			pC = pB * int(c / pB) + pB
			if pB <= pC:
				res = abs(pA - a) + abs(pB - b) + abs(pC - c)
				if res < ans:
					ans = res
					(output[0], output[1], output[2]) = (pA, pB, pC)
	print(ans)
	for j in range(3):
		print(output[j], end=' ')
	print('')


import atexit
import io
import sys
import math
from collections import defaultdict, Counter
t = int(input())
for i in range(t):
	(a, b, c) = map(int, input().split())
	ans = 10000000
	l = []
	for j in range(1, 2 * a):
		k = 1
		while j * k < 2 * b:
			count = abs(a - j)
			b1 = j * k
			count += abs(b - b1)
			k += 1
			c1 = c
			if b1 <= c:
				d = c % b1
				if d <= b1 // 2:
					c1 -= d
				else:
					c1 += b1 - d
				count += min(d, b1 - d)
			else:
				c1 = b1
				count += b1 - c
			if count < ans:
				ans = count
				l = [j, b1, c1]
	print(ans)
	print(*l)


import random, math
from copy import deepcopy as dc
from bisect import bisect_left, bisect_right

def solution(a, b, c):
	fin = float('inf')
	(A, B, C) = (0, 0, 0)
	for i in range(1, 11000):
		for j in range(i, 11000, i):
			a_f = i + 1 - 1
			b_f = j + 1 - 1
			prev_c = c // b_f * b_f
			nex_c = (c // b_f + 1) * b_f
			op = 0
			if abs(prev_c - c) <= abs(nex_c - c) and prev_c != 0:
				op += abs(prev_c - c)
				c_f = prev_c + 1 - 1
			else:
				op += abs(nex_c - c)
				c_f = nex_c + 1 - 1
			op += abs(a_f - a)
			op += abs(b_f - b)
			if op < fin:
				fin = op + 1 - 1
				(A, B, C) = (a_f, b_f, c_f)
	return [fin, A, B, C]

def input_test():
	for _ in range(int(input())):
		(a, b, c) = map(int, input().strip().split(' '))
		out = solution(a, b, c)
		print(out[0])
		print(*out[1:])

def test():
	pass
input_test()


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	x = float('inf')
	(s, d, f) = (0, 0, 0)
	w = []
	for i in range(1, 11000):
		for j in range(i, 11000, i):
			for k in range(j, 11000, j):
				t = abs(a - i) + abs(b - j) + abs(c - k)
				if t < x:
					x = t
					(s, d, f) = (i, j, k)
	print(x)
	print(str(s) + ' ' + str(d) + ' ' + str(f))


import bisect

def find_le(x, a):
	i = bisect.bisect_right(a, x)
	if i:
		return a[i - 1]
	raise ValueError

def find_ge(x, a):
	i = bisect.bisect_left(a, x)
	if i != len(a):
		return a[i]
	return a[0]

def getA(a, b):
	le = find_le(a, Divs[b])
	ge = find_ge(a, Divs[b])
	if abs(le - a) < abs(ge - a):
		return le
	else:
		return ge

def getC(c, b):
	k = c // b
	c1 = (k - 1) * b
	c2 = k * b
	c3 = (k + 1) * b
	d1 = abs(c1 - c)
	d2 = abs(c2 - c)
	d3 = abs(c3 - c)
	if min([d1, d2, d3]) == d1 and c1 >= b:
		return c1
	elif min([d1, d2, d3]) == d2 and c2 >= b:
		return c2
	else:
		return c3
T = int(input())
Divs = []
for i in range(20001):
	tmp = i
	divs = []
	for j in range(1, int(tmp ** 0.5) + 1):
		if tmp % j == 0:
			divs.append(j)
	for j in range(len(divs)):
		divs.append(i // divs[j])
	Divs.append(sorted(list(set(divs))))
for t in range(T):
	(a, b, c) = [int(k) for k in input().split()]
	best = pow(10, 10)
	ABC = [0, 0, 0]
	for B in range(1, 20001):
		A = getA(a, B)
		C = getC(c, B)
		if abs(A - a) + abs(B - b) + abs(C - c) < best:
			best = abs(A - a) + abs(B - b) + abs(C - c)
			ABC = [A, B, C]
	print(best)
	print(ABC[0], ABC[1], ABC[2])


for _ in range(int(input())):
	(a, b, c) = map(int, input().split())
	(a1, a2, a3) = (1, 1, 1)
	a_dist = 999999999999999
	for first in range(1, pow(10, 4) + 1000):
		for second in range(first, pow(10, 4) + 1000, first):
			for third in range(second, pow(10, 4) + 1000, second):
				possibility = (first, second, third)
				current_dist = abs(first - a) + abs(second - b) + abs(third - c)
				if current_dist < a_dist:
					(a1, a2, a3) = (first, second, third)
					a_dist = current_dist
	print(a_dist)
	print(a1, a2, a3)


for testid in range(int(input())):
	(a, b, c) = map(int, input().split())
	(A, B, C) = (0, 0, 0)
	res = 1000000000
	for x in range(1, 2 * a + 1):
		for y in range(x, 2 * b + 1, x):
			for k in range(2):
				z = y * (c // y) + k * y
				temp = abs(a - x) + abs(b - y) + abs(c - z)
				if temp < res:
					res = temp
					(A, B, C) = (x, y, z)
	print(res)
	print(A, B, C)