Soon after the Chunga-Changa island was discovered, it started to acquire some forms of civilization and even market economy. A new currency arose, colloquially called "chizhik". One has to pay in chizhiks to buy a coconut now.

Sasha and Masha are about to buy some coconuts which are sold at price $z$ chizhiks per coconut. Sasha has $x$ chizhiks, Masha has $y$ chizhiks. Each girl will buy as many coconuts as she can using only her money. This way each girl will buy an integer non-negative number of coconuts.

The girls discussed their plans and found that the total number of coconuts they buy can increase (or decrease) if one of them gives several chizhiks to the other girl. The chizhiks can't be split in parts, so the girls can only exchange with integer number of chizhiks.

Consider the following example. Suppose Sasha has $5$ chizhiks, Masha has $4$ chizhiks, and the price for one coconut be $3$ chizhiks. If the girls don't exchange with chizhiks, they will buy $1 + 1 = 2$ coconuts. However, if, for example, Masha gives Sasha one chizhik, then Sasha will have $6$ chizhiks, Masha will have $3$ chizhiks, and the girls will buy $2 + 1 = 3$ coconuts. 

It is not that easy to live on the island now, so Sasha and Mash want to exchange with chizhiks in such a way that they will buy the maximum possible number of coconuts. Nobody wants to have a debt, so among all possible ways to buy the maximum possible number of coconuts find such a way that minimizes the number of chizhiks one girl gives to the other (it is not important who will be the person giving the chizhiks).


-----Input-----

The first line contains three integers $x$, $y$ and $z$ ($0 \le x, y \le 10^{18}$, $1 \le z \le 10^{18}$) — the number of chizhics Sasha has, the number of chizhics Masha has and the price of a coconut. 


-----Output-----

Print two integers: the maximum possible number of coconuts the girls can buy and the minimum number of chizhiks one girl has to give to the other.


-----Examples-----
Input
5 4 3

Output
3 1

Input
6 8 2

Output
7 0



-----Note-----

The first example is described in the statement. In the second example the optimal solution is to dot exchange any chizhiks. The girls will buy $3 + 4 = 7$ coconuts.

Difficulty: EASY

Solutions:
(x, y, z) = map(int, input().split())
A = []
k = (x + y) // z
a = x % z
b = y % z
if x % z == 0 or y % z == 0:
	l = 0
elif x // z + y // z == k:
	l = 0
elif x % z + y % z == z - 1:
	l = 0
else:
	l = min(z - a, z - b)
A.append(k)
A.append(l)
print(str(A[0]) + ' ' + str(A[1]))


ls = list(map(int, input().split()))
(x, y, z) = (ls[0], ls[1], ls[2])
if x % z == 0 and y % z == 0:
	n = x // z + y // z
	print(str(n) + ' ' + '0')
else:
	maxamount = (x + y) // z
	if maxamount == x // z + y // z:
		print(str(maxamount) + ' ' + '0')
	else:
		r = z - max(x % z, y % z)
		print(str(maxamount) + ' ' + str(r))


(x, y, z) = map(int, input().split())
ans = 0
ans += x // z
ans += y // z
x = x % z
y = y % z
ans1 = 0
if x + y >= z:
	ans1 += z - max(x, y)
	ans += 1
print(ans, ans1)


def calculate(sasha, masha, cocoCost):
	sashaCoc = sasha % cocoCost
	mashaCoc = masha % cocoCost
	totalCoco = sasha // cocoCost + masha // cocoCost
	totalCoco += (sashaCoc + mashaCoc) // cocoCost
	rem = getExchangeAmount(sashaCoc, mashaCoc, cocoCost)
	answers = [totalCoco, rem]
	return answers

def getExchangeAmount(sCost, mCost, cCost):
	if sCost == 0 or mCost == 0:
		return 0
	var1 = cCost - sCost
	var2 = cCost - mCost
	if var1 > mCost:
		var1 = cCost
	if var2 > sCost:
		var2 = cCost
	if var1 == cCost and var2 == cCost:
		return 0
	return min(var1, var2)
numbers = list(map(int, input().split()))
sasha = numbers[0]
masha = numbers[1]
cocoCost = numbers[2]
answers = calculate(sasha, masha, cocoCost)
print(*answers)


(x, y, z) = (int(arg) for arg in input().split(' '))
max_coconuts = x // z
max_coconuts += y // z
share = 0
x = x % z
y = y % z
if x + y >= z:
	max_coconuts += 1
	share = z - x if x > y else z - y
print(max_coconuts, share)


(x, y, z) = map(int, input().split())
ans = x // z + y // z
k = 0
if (x + y) // z > ans:
	ans = (x + y) // z
	k = min(z - x % z, z - y % z)
print(ans, k)


(x, y, z) = map(int, input().split())
print((x + y) // z, end=' ')
j = x % z
k = y % z
if k + j >= z:
	print(z - max(k, j))
else:
	print(0)


(x, y, z) = list(map(int, input().split()))
if x % z + y % z < z:
	print(x // z + y // z, 0)
elif x % z >= y % z:
	print(x // z + y // z + 1, z - x % z)
else:
	print(x // z + y // z + 1, z - y % z)


(x, y, z) = map(int, input().split())
a = x - x // z * z
b = y - y // z * z
if a + b < z:
	print((x + y) // z, 0)
else:
	print((x + y) // z, min(z - a, z - b))


(x, y, z) = map(int, input().split())
print((x + y) // z, end=' ')
if x // z + y // z == (x + y) // z:
	print(0)
else:
	print(min(z - x % z, z - y % z))


import sys
inf = float('inf')
mod = 1000000007

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

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

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

def int1():
	return int(input())
import string
import math
from itertools import combinations

def main():
	(x, y, z) = get_array()
	z1 = (x + y) // z
	r1 = x % z
	r2 = y % z
	if r1 + r2 >= z:
		z2 = z - max(r2, r1)
	else:
		z2 = 0
	print(z1, z2)
main()


(s, m, c) = list(map(int, input().split()))
k = s // c
k = k + m // c
x = s % c
y = m % c
d = c - max(x, y)
if min(x, y) >= d:
	k += 1
else:
	d = 0
print(k, d)


(a, b, c) = list(map(int, input().split()))
n = a // c + b // c
m1 = a % c
m2 = b % c
add = 0
if m1 + m2 >= c:
	add = c - max(m1, m2)
	n += 1
print(n, add)


(x, y, z) = map(int, input().split())
c = 0
c += x // z
c += y // z
x %= z
y %= z
f = x + y
c += f // z
f %= z
print(c, end=' ')
min_now = 10000000000
X = max(0, x - f)
Y = max(0, y - f)
print(min(X, Y))


(x, y, z) = map(int, input().split())
a = x // z
b = y // z
c = a + b
d = (x % z + y % z) // z
if d == 0:
	print(c, 0)
else:
	print(c + d, d * z - max(x % z, y % z))


(a, b, c) = map(int, input().split())
d = (a + b) // c
e = a % c
f = b % c
(e, f) = (max(e, f), min(e, f))
extra = d - (a // c + b // c)
if extra > 0:
	print(d, c - e)
else:
	print(d, 0)


inputs = input().split(' ')
x = int(inputs[0])
y = int(inputs[1])
z = int(inputs[2])
maxNoOfCoconuts = (x + y) // z
sashaRemaining = x % z
mashaRemaining = y % z
given = 0
if maxNoOfCoconuts > x // z + y // z:
	given = z - max(sashaRemaining, mashaRemaining)
print(maxNoOfCoconuts, given)


s = input().split()
ans = (int(s[0]) + int(s[1])) // int(s[2])
r_1 = int(s[0]) % int(s[2])
r_2 = int(s[1]) % int(s[2])
r_sum = (r_1 + r_2) % int(s[2])
if r_1 + r_2 < int(s[2]):
	r_ans = 0
elif r_1 > r_2:
	r_ans = r_2 - r_sum
else:
	r_ans = r_1 - r_sum
print(ans, r_ans)


x = input().split()
s = int(x[0])
m = int(x[1])
price = int(x[2])
total = (s + m) // price
borrow = 0
if s % price > m % price:
	if m % price >= price - s % price:
		borrow = price - s % price
	else:
		borrow = 0
elif s % price >= price - m % price:
	borrow = price - m % price
else:
	borrow = 0
print(total, borrow)


(a, b, c) = map(int, input().split())
x = a // c
y = b // c
a1 = (a + b) // c
if a1 == x + y:
	a2 = 0
else:
	a2 = min(c - a % c, c - b % c)
print(a1, a2)


(x, y, z) = [int(ele) for ele in input().split(' ')]
totalCoco = (x + y) // z
if totalCoco != x // z + y // z:
	a = (z - x) % z
	b = (z - y) % z
	if a < 0:
		a += z
	if b < 0:
		b += z
	transferCoco = min(x % z, y % z, a, b)
else:
	transferCoco = 0
print(totalCoco, transferCoco)


(x, y, z) = map(int, input().split())
if x < y:
	(x, y) = (y, x)
coco = x // z + y // z
borrow = 0
if x % z == 0 or y % z == 0:
	borrow = 0
elif x % z + y % z >= z:
	coco += 1
	borrow = min(z - x % z, z - y % z)
print(f'{coco} {borrow}')


from sys import stdin, stdout
from collections import Counter

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

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

def ip():
	return int(stdin.readline().strip())

def op(ans):
	return stdout.write(str(ans) + '\n')
(x, y, z) = ei()
if x % z == 0 or y % z == 0:
	print((x + y) // z, 0)
else:
	ans = z - max(x % z, y % z)
	if ans > min(x % z, y % z):
		ans = 0
	print((x + y) // z, ans)


s = input()
(x, y, p) = s.split()
x = int(x)
y = int(y)
p = int(p)
print((x + y) // p, end=' ')
rx = x % p
ry = y % p
if rx == 0 or ry == 0 or rx + ry < p:
	print(0)
else:
	print(p - max(rx, ry))


R = lambda : map(int, input().split())
(a, b, c) = R()
k = (a + b) // c
if a % c == 0 and b % c == 0:
	print(k, 0)
	quit()
if c > a and c > b:
	if k == 0:
		print(0, 0)
	else:
		print(k, c - max(a, b))
elif c > a:
	if k == b // c:
		print(k, 0)
	else:
		print(k, c - max(a % c, b % c))
elif c > b:
	if k == a // c:
		print(k, 0)
	else:
		print(k, c - max(a % c, b % c))
elif k == a // c + b // c:
	print(k, 0)
else:
	print((a + b) // c, c - max(a % c, b % c))


import os
import sys
from collections import deque
import pdb
import heapq
from heapq import *
from pprint import pprint
from bisect import *
from math import *
sys.setrecursionlimit(999999999)
if os.getcwd() == 'C:\\Users\\User\\Desktop\\python\\Prog\\CodeForces':
	pdb = pdb.Pdb(stdin=sys.stdin, stdout=sys.stdout)
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')

def ri():
	return [int(i) for i in input().split()]
(x, y, z) = ri()
ans = 0
ans += x // z + y // z
x %= z
y %= z
if x + y >= z:
	ans += 1
	print(ans, min(z - x, z - y))
else:
	print(ans, 0)


(x, y, z) = [int(i) for i in input().split()]
if x // z + y // z == (x + y) // z:
	print((x + y) // z, 0)
else:
	print((x + y) // z, min(z - x % z, z - y % z))


(x0, y0, z) = map(int, input().split(' '))
result = (x0 + y0) // z
x = x0 % z
y = y0 % z
print(result, 0 if result <= x0 // z + y0 // z else min(x, y, (z - x) % z, (z - y) % z))


(x, y, z) = [int(x) for x in input().split()]
p = x // z + y // z < (x + y) // z
if p:
	print((x + y) // z, end=' ')
	print(min(z - x % z, z - y % z))
else:
	print(x // z + y // z, 0)


(x, y, z) = map(int, input().split())
s = x // z + y // z
m1 = (x % z + y % z) // z
if m1 == 0:
	print(s, 0)
else:
	mx = x % z
	my = y % z
	m0 = min(min(mx, z - my), min(my, z - mx))
	print(s + m1, m0)


(a, b, c) = input().split(' ')
e = int(a) % int(c)
f = int(b) % int(c)
d = int()
if e > f:
	if e + f >= int(c):
		d = int(c) - e
elif f > e:
	if e + f >= int(c):
		d = int(c) - f
elif e == f:
	if e + f >= int(c):
		d = int(c) - e
	else:
		d = 0
print((int(a) + int(b)) // int(c), end=' ')
print(d)


chungaChanga = input().split(' ')
person1Money = int(chungaChanga[0])
person2Money = int(chungaChanga[1])
coconutPrice = int(chungaChanga[2])
maxCoconuts = int((person1Money + person2Money) // coconutPrice)
availableBorrow = min(person1Money % coconutPrice, person2Money % coconutPrice)
if coconutPrice - max(person1Money % coconutPrice, person2Money % coconutPrice) <= availableBorrow:
	minDebt = coconutPrice - max(person1Money % coconutPrice, person2Money % coconutPrice)
else:
	minDebt = 0
print(str(maxCoconuts) + ' ' + str(minDebt))


(x, y, z) = input().split()
x = int(x)
y = int(y)
z = int(z)
coconut = x // z + y // z
pot_x = x % z
pot_y = y % z
borrow = 0
if pot_x + pot_y >= z:
	coconut += (pot_x + pot_y) // z
	if pot_x % z >= pot_y % z:
		borrow = (coconut - (x // z + y // z)) * z - pot_x
	else:
		borrow = (coconut - (x // z + y // z)) * z - pot_y
else:
	print(coconut, borrow)
	exit(0)
print(coconut, borrow)


(x, y, z) = [int(i) for i in input().split()]
maxCoconut = (x + y) // z
xx = x % z
yy = y % z
maxOfMods = xx if xx >= yy else yy
minTransaction = 0
if xx + yy >= z:
	minTransaction = z - maxOfMods
print(maxCoconut, minTransaction)


import math
(s, m, p) = map(int, input().split())
c = (s + m) // p
sNeed = p - s % p
mNeed = p - m % p
t = min(sNeed, mNeed) if s % p + m % p >= p else 0
print(c, t)


(x, y, z) = list(map(int, input().split()))
c = x // z + y // z
rx = x % z
ry = y % z
if rx + ry < z:
	print(f'{c} 0')
elif rx > ry:
	print(f'{c + 1} {z - rx}')
else:
	print(f'{c + 1} {z - ry}')


(x, y, z) = list(map(int, input().split()))
ans1 = (x + y) // z
(d1, d2) = (x // z, y // z)
s1 = (ans1 - d1) * z - y
s2 = (ans1 - d2) * z - x
if ans1 == 0:
	(s1, s2) = (0, 0)
elif x % z + y % z < z:
	(s1, s2) = (0, 0)
print(ans1, end=' ')
print(min(s1, s2))


arr = [int(x) for x in input().split()]
x = arr[0]
y = arr[1]
z = arr[2]
ma = (x + y) // z
if ma == x // z + y // z:
	print(ma, 0)
else:
	a = x % z
	b = y % z
	if a > b:
		print(ma, z - a)
	else:
		print(ma, z - b)


def maximum(p, q):
	if p > q:
		return p
	else:
		return q
(x, y, z) = map(int, input().split())
a = x // z
b = y // z
r1 = x % z
r2 = y % z
if r1 + r2 >= z:
	max = a + b + 1
	debt = z - maximum(r1, r2)
else:
	max = a + b
	debt = 0
print(max, end=' ')
print(debt)


import sys
import math
fileoperation = 0
if fileoperation:
	orig_stdout = sys.stdout
	orig_stdin = sys.stdin
	inputfile = open('W:/Competitive Programming/input.txt', 'r')
	outputfile = open('W:/Competitive Programming/output.txt', 'w')
	sys.stdin = inputfile
	sys.stdout = outputfile
mod = 1000000007

def nospace(l):
	ans = ''.join((str(i) for i in l))
	return ans
t = 1
for tt in range(t):
	(x, y, z) = map(int, sys.stdin.readline().split(' '))
	tot = (x + y) // z
	r1 = x % z
	r2 = y % z
	if r1 + r2 >= z:
		print(tot, min(z - r1, z - r2))
	else:
		print(tot, 0)
if fileoperation:
	sys.stdout = orig_stdout
	sys.stdin = orig_stdin
	inputfile.close()
	outputfile.close()


(x, y, z) = map(int, input().split())
coconuts = x // z + y // z
x %= z
y %= z
given = 0
if x + y >= z:
	given = z - max(x, y)
print(coconuts + min(1, given), given)


(x, y, z) = list(map(int, input().split()))
max_coc = (x + y) // z
if x // z + y // z == max_coc:
	give = 0
else:
	r1 = x % z
	r2 = y % z
	give = min(r1, r2, z - r1, z - r2)
print(max_coc, give)


(x, y, z) = map(int, input().split())
ans1 = (x + y) // z
p = x % z
q = y % z
if p + q >= z:
	ans2 = min(z - p, z - q)
else:
	ans2 = 0
print(ans1, ans2)


from sys import stdin
(x, y, z) = map(int, stdin.readline().split())
a = 0
if x % z != 0:
	a = z - x % z
b = 0
if y % z != 0:
	b = z - y % z
k = min(a, b)
p = (x + y) // z
if p == x // z + y // z:
	k = 0
print(str(p) + ' ' + str(k))


import math
import sys
import bisect
(a, b, c) = map(int, input().split())
res = a // c + b // c
(r, t) = (min(a % c, b % c), max(a % c, b % c))
s = 0
if t + r >= c:
	s = c - t
	res += 1
print(res, s)


(x, y, z) = map(int, input().split())
t = (x + y) // z
tz = (x + y) % z
a = max(min(x % z - tz, y % z - tz), 0)
print(t, a)


import sys
input = sys.stdin.readline
from collections import *
(x, y, z) = map(int, input().split())
if (x + y) // z > x // z + y // z:
	print((x + y) // z, min(z - x % z, x % z, z - y % z, y % z))
else:
	print((x + y) // z, 0)


(x, y, z) = map(int, input().split())
r = x // z + y // z
x -= x // z * z
y -= y // z * z
c = 0
if x + y >= z:
	c = min(-x % z, -y % z)
	r += 1
print(r, c)


(x, y, z) = list(map(int, input().split()))
nb = 0
nb += x // z
x = x % z
nb += y // z
y = y % z
res = 0
if x + y >= z:
	res = z - max(x, y)
	nb += 1
print(nb, res)


def ans():
	N = input().split()
	a = int(N[0])
	b = int(N[1])
	mon = int(N[2])
	d = min([abs(mon - a % mon), abs(mon - b % mon)])
	if a % mon + b % mon >= mon:
		print((a + b) // mon, d)
	else:
		print((a + b) // mon, 0)
ans()


(x, y, z) = list(map(int, input().split()))
no_of_coconuts = (x + y) // z
x_money_left = x % z
y_money_left = y % z
minimum = min(x_money_left, y_money_left)
maximum = max(x_money_left, y_money_left)
coconut = (maximum + minimum) // z
if coconut == 0:
	print(no_of_coconuts, 0)
else:
	coconut_price = coconut * z - maximum
	print(no_of_coconuts, coconut_price)


from bisect import *
from collections import *
from itertools import *
import functools
import sys
from math import *
from decimal import *
from copy import *
getcontext().prec = 30
MAX = sys.maxsize
MAXN = 10 ** 5 + 10
MOD = 10 ** 9 + 7

def isprime(n):
	n = abs(int(n))
	if n < 2:
		return False
	if n == 2:
		return True
	if not n & 1:
		return False
	for x in range(3, int(n ** 0.5) + 1, 2):
		if n % x == 0:
			return False
	return True

def mhd(a, b):
	return abs(a[0] - b[0]) + abs(b[1] - a[1])

def charIN(x=' '):
	return sys.stdin.readline().strip().split(x)

def arrIN(x=' '):
	return list(map(int, sys.stdin.readline().strip().split(x)))

def eld(x, y):
	a = y[0] - x[0]
	b = x[1] - y[1]
	return (a * a + b * b) ** 0.5

def lgcd(a):
	g = a[0]
	for i in range(1, len(a)):
		g = math.gcd(g, a[i])
	return g

def ms(a):
	msf = -MAX
	meh = 0
	st = en = be = 0
	for i in range(len(a)):
		meh += a[i]
		if msf < meh:
			msf = meh
			st = be
			en = i
		if meh < 0:
			meh = 0
			be = i + 1
	return (msf, st, en)

def flush():
	return sys.stdout.flush()
(x, y, z) = arrIN()
if x % z == 0 and y % z == 0:
	print(x // z + y // z, 0)
else:
	if x < y:
		(x, y) = (y, x)
	if x % z == 0:
		print(x // z + y // z, 0)
	elif y % z == 0:
		print(x // z + y // z, 0)
	else:
		t = z - x % z
		u = z - y % z
		a = x // z + y // z
		if t < u:
			if t <= y:
				y -= t
				x += t
				s = x // z + y // z
				if s > a:
					print(s, t)
				else:
					print(a, 0)
			else:
				print(x // z + y // z, 0)
		elif u <= x:
			y += u
			x -= u
			s = x // z + y // z
			if s > a:
				print(s, u)
			else:
				print(a, 0)
		else:
			print(x // z + y // z, 0)


(x, y, z) = map(int, input().split())
a = (z - x % z) % z
b = (z - y % z) % z
cur = x // z + y // z
curs = 0
if a <= y % z:
	cur1 = (x + a) // z + (y - a) // z
	if cur1 > cur:
		cur = cur1
		curs = a
if b <= x % z:
	cur1 = (x - b) // z + (y + b) // z
	if cur1 > cur or (cur1 == cur and curs > b):
		cur = cur1
		curs = b
print(cur, curs)


(x, y, z) = [int(k) for k in input().split(' ')]
bn = x // z + y // z
left = x + y - bn * z
if left >= z:
	print(bn + 1, min(z - x % z, z - y % z))
else:
	print(bn, 0)


def main():
	buf = input()
	buflist = buf.split()
	x = int(buflist[0])
	y = int(buflist[1])
	z = int(buflist[2])
	coc = x // z + y // z
	x %= z
	y %= z
	if x + y < z:
		print(coc, 0)
		return
	else:
		give = min(z - x, z - y)
		print(coc + 1, give)
		return
main()


(a, b, x) = map(int, input().split())
s = (a + b) // x
p = a // x
q = b // x
z = 0
if p + q < s:
	z = min(x - a % x, x - b % x)
print(s, z)


(x, y, z) = map(int, input().split())
min_give = min(min(x % z, z - x % z), min(y % z, z - y % z))
r1 = (x + y) // z
r2 = x // z + y // z
if r1 == r2:
	min_give = 0
print(f'{r1} {min_give}')


(z, c, a) = list(map(int, input().split()))
print((z + c) // a, max(min(z % a - (z + c) % a, c % a - (z + c) % a), 0))


(x, y, z) = map(int, input().split())
k = 0
k += x // z + y // z
x %= z
y %= z
h = 0
if x + y >= z:
	k += 1
	h = z - max(x, y)
print(k, h)


(x, y, p) = map(int, input().split())
mxbought = (x + y) // p
minigave = min(p - x % p, p - y % p)
print(mxbought, end=' ')
x = x % p
y = y % p
if x + y >= p:
	print(p - max(x, y))
else:
	print(0)


(x, y, z) = map(int, input().split())
c = (x + y) // z
x %= z
y %= z
print(c, end=' ')
if x + y >= z:
	print(z - max(x, y))
else:
	print(0)


(x, y, z) = map(int, input().split())
ret = x // z + y // z
hi = 0
mod_x = x % z
mod_y = y % z
if not mod_x or not mod_y:
	pass
else:
	mod_x_z = z - mod_x
	mod_y_z = z - mod_y
	if mod_x + mod_y < z:
		hi = 0
	elif mod_x_z < mod_y_z:
		ret += 1
		hi = mod_x_z
	else:
		ret += 1
		hi = mod_y_z
print(ret, hi)


(a, b, c) = map(int, input().split())
s = a + b
s1 = s // c
if a % c == 0 or b % c == 0:
	print(s1, 0)
elif a // c + b // c == s1:
	print(s1, 0)
else:
	m = a % c
	m1 = c - m
	m2 = b % c
	m3 = c - m2
	print(s1, min(m, m1, m2, m3))


(x, y, z) = map(int, input().split())
if x % z == 0 or y % z == 0:
	print(x // z + y // z, 0)
else:
	yy = y % z
	xx = x % z
	if yy + xx >= z:
		print(x // z + y // z + 1, min(z - xx, z - yy))
	else:
		print(x // z + y // z, 0)


(x, y, z) = map(int, input().split())
a = x % z
b = y % z
q = 0
if a + b == z:
	if a > b:
		y -= b
		x += b
		q += b
	else:
		x -= a
		y += a
		q += a
elif a + b > z:
	if a > b:
		x += z - a
		y -= z - a
		q += z - a
	else:
		y += z - b
		x -= z - b
		q += z - b
print(x // z + y // z, q)


(x, y, z) = map(int, input().split())
ans = (x + y) // z
(n, m) = (x % z, y % z)
if n + m >= z:
	print(ans, min(z - n, z - m))
else:
	print(ans, 0)


(a, b, c) = map(int, input().split())
if a % c + b % c >= c:
	print((a + b) // c, min(c - a % c, c - b % c))
else:
	print((a + b) // c, 0)


(x, y, z) = map(int, input().split())
cnt = x // z + y // z
r1 = x % z
r2 = y % z
dif = 0
if r1 + r2 >= z:
	cnt += 1
	dif = min(z - r1, z - r2)
print(cnt, dif)


arr = list(map(int, input().split(' ')))
c1 = arr[0] // arr[2]
c2 = arr[1] // arr[2]
d1 = arr[0] % arr[2]
d2 = arr[1] % arr[2]
pos = (d1 + d2) // arr[2]
l = list()
l.append(c1 + c2 + pos)
if pos > 0:
	req = pos * arr[2] - max(d1, d2)
	l.append(req)
else:
	l.append(0)
print(l[0], l[1])


(s, m, c) = map(int, input().split())
total = (s + m) // c
sasha = s % c
sasha_buy = s // c
masha_buy = m // c
masha = m % c
ex = max(sasha, masha)
change = c - ex
if total == sasha_buy + masha_buy:
	print(total, 0)
else:
	print(total, change)


(m1, m2, c) = map(int, input().split())
total_coconut = m1 // c + m2 // c
remaining_money = m1 % c + m2 % c
money_exchange = 0
if remaining_money >= c:
	total_coconut += 1
	money_exchange = c - max(m1 % c, m2 % c)
print(total_coconut, money_exchange)


(x, y, z) = list(map(int, input().split()))
r = x // z + y // z
t = 0
s = min(x % z, y % z)
i = z - max(x % z, y % z) % z
if i != z and i <= s:
	r += (max(x % z, y % z) + i) // z
	t = i
print(r, t)


(a, b, p) = map(int, input().split(' '))
num = (a + b) // p
if a % p + b % p >= p:
	print(num, p - max(a % p, b % p))
else:
	print(num, 0)


(x, y, z) = map(int, input().split())
a = (x + y) // z
xm = x % z
ym = y % z
if x // z + y // z == a:
	ans = 0
else:
	ans = min(z - xm, z - ym)
print((x + y) // z, ans)


def ain():
	return map(int, input().split())
(x, y, z) = ain()
c = (x + y) // z
if c == 0:
	print(0, 0)
elif x % z == 0 or y % z == 0:
	print(c, 0)
else:
	q = x % z
	w = y % z
	d = min(z - q, z - w)
	if c > x // z + y // z:
		print(c, d)
	else:
		print(c, 0)


(x, y, z) = map(int, input().split())
r1 = x % z
r2 = y % z
q1 = x // z
q2 = y // z
if r1 == 0 and r2 == 0:
	print(q1 + q2, 0)
elif r1 == 0 or r2 == 0:
	print(q1 + q2, 0)
elif r1 > r2:
	q3 = (r1 + r2) // z
	print(q1 + q2 + q3, q3 * (z - r1))
else:
	q3 = (r1 + r2) // z
	print(q1 + q2 + q3, q3 * (z - r2))


(sasha, masha, price) = map(int, input().split())
c_sasha = sasha % price
c_masha = masha % price
print((sasha + masha) // price, end=' ')
if c_sasha + c_masha >= price:
	if c_sasha > c_masha:
		print(price - c_sasha)
	else:
		print(price - c_masha)
else:
	print(0)


(A, B, Price) = map(int, input().split())
Total = int(A // Price + B // Price)
First = A % Price
Second = B % Price
Ans = 0
if First + Second >= Price:
	Total += 1
	Ans = Price - max(First, Second)
print(Total, Ans)


def solve():
	(x, y, z) = map(int, input().split())
	mx = (x + y) // z
	amount = 0
	if x % z + y % z >= z:
		amount = min(z - x % z, z - y % z)
	print(mx, amount)
solve()


(x, y, z) = map(int, input().split())
a1 = x // z + y // z
a2 = (x + y) // z
if a1 >= a2:
	print(a1, 0)
else:
	print(a2, z - max(x % z, y % z))


(a, b, c) = map(int, input().split())
t = a % c
t1 = b % c
if t == 0 or t1 == 0:
	print(a // c + b // c, 0)
elif t + t1 < c:
	print(a // c + b // c, 0)
else:
	print(a // c + b // c + (t + t1) // c, min(c - t, c - t1))


(x, y, z) = map(int, input().split())
p = x % z
q = y % z
mn = 0
mx = 0
(cx, cy) = (0, 0)
if p > q:
	if z - p <= q:
		mn = z - p
		x += mn
		cx = 1
	else:
		mn = 0
elif z - q <= p:
	mn = z - q
	y += mn
	cy = 1
else:
	mn = 0
ans = x // z + y // z
print(ans, mn)


def sum_digits(n):
	r = 0
	while n:
		(r, n) = (r + n % 10, n // 10)
	return r
(x, y, z) = input().split(' ')
x = int(x)
y = int(y)
z = int(z)
if x % z == 0 and y % z == 0:
	print(x // z + y // z, 0)
else:
	m = x % z
	n = y % z
	if m + n == z:
		print(x // z + y // z + 1, min(m, n))
	elif m + n < z:
		print(x // z + y // z, 0)
	else:
		print(x // z + y // z + 1, z - max(m, n))


(x, y, z) = map(int, input().split())
(k, l) = (x % z, y % z)
if k + l == z:
	print((x + y) // z, min(k, l))
elif k + l < z:
	print((x + y) // z, 0)
else:
	print((x + y) // z, z - max(k, l))


(a, b, c) = map(int, input().split())
x = a // c + b // c
y = (a + b) // c
if x == y:
	print(x, 0)
elif a % c + b % c == c:
	if a % c >= b % c:
		print((a + b % c) // c + (b - b % c) // c, b % c)
	else:
		print((a + b % c) // c + (b - b % c) // c, a % c)
elif a % c + b % c > c:
	if a % c >= b % c:
		print((a + b % c) // c + (b - b % c) // c, c - a % c)
	else:
		print((a + b % c) // c + (b - b % c) // c, c - b % c)


(x, y, z) = input().split()
x = int(x)
y = int(y)
z = int(z)
tot = (x + y) // z
remx = x % z
remy = y % z
if remx != 0 and remy != 0:
	rout = z - max(remx, remy)
	if rout > min(remx, remy):
		rout = 0
else:
	rout = 0
print(tot, rout)


inpt = input().split()
a = int(inpt[0])
b = int(inpt[1])
price = int(inpt[2])
nb = 0
nb += a // price
nb += b // price
restA = a % price
restB = b % price
res = 0
if restA + restB >= price:
	nb += 1
	if restA >= restB:
		res = price - restA
	else:
		res = price - restB
print(int(nb), res)


(x, y, z) = input().split(' ')
x = int(x)
y = int(y)
z = int(z)
total_coconut = (x + y) // z
x_cont = x // z
y_cont = y // z
orgval = x_cont + y_cont
if total_coconut == orgval:
	print(total_coconut, 0)
else:
	rem_x = x % z
	rem_y = y % z
	x_req = z - rem_x
	y_req = z - rem_y
	min_exch = x_req if x_req < y_req else y_req
	print(total_coconut, min_exch)


(x, y, z) = [int(i) for i in input().split()]
s = 0
s += x // z
x = x % z
s += y // z
y = y % z
k = 0
if x + y >= z:
	s += 1
	k = z - max(x, y)
print(s, k)


(x, y, z) = map(int, input().split())
k = (x + y) // z
if z - x % z < z - y % z:
	print(k, z - x % z if y % z >= z - x % z else 0)
else:
	print(k, z - y % z if x % z >= z - y % z else 0)


(x, y, z) = map(int, input().split())
q1 = (x + y) // z
q2 = min(z - x % z, z - y % z) if x // z + y // z < q1 else 0
print(q1, q2)


def curreExchange(x, y, z):
	ans1 = (x + y) // z
	if x % z == 0 or y % z == 0:
		ans2 = 0
		print(ans1, ans2)
		return
	if x % z + y % z >= z:
		if x % z > y % z:
			ans2 = z - x % z
		elif x % z < y % z:
			ans2 = z - y % z
		else:
			ans2 = z - x % z
	else:
		ans2 = 0
	print(ans1, ans2)
(x, y, z) = map(int, input().split())
curreExchange(x, y, z)


(x, y, z) = list(map(int, input().split()))
coconut = x // z + y // z
x = x % z
y = y % z
if x + y >= z:
	exchange = z - max(x, y)
	coconut += 1
else:
	exchange = 0
print(coconut, exchange)


import sys
input = sys.stdin.readline
(x, y, z) = map(int, input().split())
r = (x + y) // z
t = x // z + y // z
print(r, min(z - x % z, z - y % z) if r != t else 0)


(x, y, z) = map(int, input().split())
if x % z == 0 or y % z == 0:
	print(x // z + y // z, end=' ')
	print('0')
elif x % z >= y % z and x % z + y % z >= z:
	print(x // z + y // z + 1, end=' ')
	print(z - x % z)
elif x % z >= y % z and x % z + y % z < z:
	print(x // z + y // z, end=' ')
	print('0')
elif x % z <= y % z and x % z + y % z >= z:
	print(x // z + y // z + 1, end=' ')
	print(z - y % z)
else:
	print(x // z + y // z, end=' ')
	print('0')


(x, y, z) = map(int, input().split())
(q1, r1) = (x // z, x % z)
(q2, r2) = (y // z, y % z)
if r1 + r2 < z:
	coconuts = q1 + q2
	give = 0
else:
	coconuts = q1 + q2 + 1
	give = min(z - r1, z - r2)
print(str(coconuts) + ' ' + str(give))


(x, y, z) = map(int, input().split())
print((x + y) // z, (min(z - x % z, z - y % z), 0)[x % z + y % z < z])


(x, y, z) = [int(x) for x in input().split(' ')]
ans1 = (x + y) // z
if x // z + y // z == ans1:
	print(ans1, 0)
else:
	(a, b) = (x % z, y % z)
	print(ans1, min((z - a) % z, (z - b) % z))


from sys import stdin, stdout
(x, y, z) = map(int, stdin.readline().split())

def ceil(x, y):
	return 1 + (x - 1) // y
num = (x + y) // z
if num != x // z + y // z:
	closest = min(z * ceil(x, z) - x, z * ceil(y, z) - y)
else:
	closest = 0
stdout.write(str(num) + ' ' + str(closest) + '\n')


(x, y, z) = map(int, input().split())
ans1 = (x + y) // z
ans2 = 0
ans3 = 0
if x // z + y // z < (x + y) // z:
	ans2 = (z - x % z) % z
	ans3 = (z - y % z) % z
if ans2 > y:
	ans2 = 1000000000000000
if ans3 > x:
	ans3 = 1000000000000000
print(ans1, min(ans2, ans3))


(a, b, z) = map(int, input().split())
print((a + b) // z, end=' ')
if a % z + b % z < z:
	print(0)
else:
	print(min(abs(z - a % z), abs(z - b % z)))


import os

def _f(x, y, z):
	if x + y < z:
		return (0, 0)
	else:
		ost1 = x % z
		ost2 = y % z
		if z - ost1 <= ost2 or z - ost2 <= ost1:
			if z - ost1 <= z - ost2:
				return (x // z + y // z + 1, z - ost1)
			else:
				return (x // z + y // z + 1, z - ost2)
		else:
			return (x // z + y // z, 0)

def f(x, y, z):
	return ''.join((str(e) + ' ' for e in _f(x, y, z)))
if os.environ.get('DEBUG', False):
	print(f'{f(5, 4, 3)} = 3 1')
	print(f'{f(6, 8, 2)} = 7 0')
	print(f'{f(6, 8, 1)} = 14 0')
	print(f'{f(5, 5, 5)} = 2 0')
	print(f'{f(3, 1, 5)} = 0 0')
	print(f'{f(3, 2, 5)} = 1 2')
	print(f'{f(7, 5, 5)} = 2 0')
	print(f'{f(7, 4, 5)} = 2 1')
else:
	(x, y, z) = list(map(int, input().split()))
	print(f(x, y, z))


from sys import stdin
input = stdin.readline
(y, x, z) = map(int, input().split())
ans = (x + y) // z
ost1 = x % z - (z - y % z)
ost2 = y % z - (z - x % z)
p = []
if ost1 >= 0:
	p.append(min(x % z, z - y % z))
if ost2 >= 0:
	p.append(min(y % z, z - x % z))
if len(p) == 0:
	p.append(0)
print(ans, min(p))


(x, y, z) = [int(i) for i in input().split(' ')]
maxi = (x + y) // z
resx = x % z
resy = y % z
if resx == 0 or resy == 0 or (resx + resy) // z == 0:
	mini = 0
elif resx > resy:
	mini = z - resx
else:
	mini = z - resy
print('%d %d' % (maxi, mini))


def input_as_list():
	return list(map(int, input().split()))
(x, y, z) = input_as_list()
n = (x + y) // z
(xr, yr) = (x % z, y % z)
if xr + yr >= z:
	d = min(z - xr, z - yr)
else:
	d = 0
print(n, d)


(a, b, c) = map(int, input().split())
ans = a // c + b // c
ans1 = 0
if a % c < b % c and a % c + b % c >= c:
	ans += (b % c + a % c) // c
	ans1 = c - b % c
elif a % c + b % c >= c:
	ans += (b % c + a % c) // c
	ans1 = c - a % c
print(ans, ans1)


(x, y, z) = list(map(int, input().split()))
v1 = x // z
v2 = y // z
v3 = x % z
v4 = y % z
if v3 + v4 < z:
	print(int(v1 + v2), 0)
else:
	print(int(v1 + v2 + 1), z - max(v3, v4))


import math

def f():
	return map(int, input().split())
(x, y, z) = f()
coconut = x // z + y // z
x %= z
y %= z
exchange = 0
if x + y < z:
	exchange = 0
else:
	coconut += (x + y) // z
	exchange = min(abs(x - z), abs(y - z))
print(coconut, exchange)


(x, y, z) = [int(i) for i in input().split()]
totalCoco = (x + y) // z
sashaCoco = x // z
mashaCoco = y // z
if sashaCoco + mashaCoco == totalCoco:
	print(totalCoco, 0)
else:
	print(totalCoco, z - max(x % z, y % z))


(x, y, z) = map(int, input().split())
num_no_exchange = x // z + y // z
num_exchange = (x + y) // z
if num_exchange > num_no_exchange:
	print(num_exchange, min(z - x % z, z - y % z))
else:
	print(num_exchange, 0)


(x, y, z) = map(int, input().strip().split())
buy = (x + y) // z
buy_without_sharing = x // z + y // z
gives = min((z - x) % z, (z - y) % z)
if buy == buy_without_sharing:
	print(buy, 0)
else:
	print(buy, gives)


(x, y, z) = map(int, input().split())
calc = 0
las1 = 0
las2 = 0
g = 0
b = x // z
calc += b
if x - b * z > 0:
	las1 = x - b * z
b = y // z
calc += b
if y - b * z > 0:
	las2 = y - b * z
if las1 + las2 >= z:
	calc += 1
	g = z - max(las1, las2)
print(calc, g)


(x, y, z) = map(int, input().split())
maxVal = (x + y) // z
if maxVal == x // z + y // z:
	print(maxVal, 0)
else:
	xRem = z - x % z
	yRem = z - y % z
	print(maxVal, min(xRem, yRem))


(s, m, z) = [int(x) for x in input().split()]
print((s + m) // z, end=' ')
k = s % z
t = m % z
v = max(k, t)
x = min(k, t)
if z - v > x:
	print(0)
else:
	print(z - v)


iarr = list(map(int, input().split()))
x = iarr[0]
y = iarr[1]
z = iarr[2]
modx = x % z
mody = y % z
if modx == 0 or mody == 0:
	print(x // z + y // z, 0)
elif modx + mody >= z:
	lef = z - max(modx, mody)
	print(x // z + y // z + 1, lef)
else:
	print(x // z + y // z, 0)


(x, y, z) = map(int, input().split())
ans1 = (x + y) // z
r1 = x % z
r2 = y % z
if r1 + r2 < z:
	ans2 = 0
else:
	ans2 = min(z - r1, z - r2)
print(ans1, ans2)


from math import *
(x, y, z) = map(int, input().split())
s = x + y
ans = s // z
m1 = x % z
m2 = y % z
if m1 + m2 > z - 1:
	print(ans, min(z - m1, z - m2))
else:
	print(ans, 0)


arr = list(map(int, input().split()))
(x, y, z) = (arr[0], arr[1], arr[2])
if x % z + y % z < z:
	print(str(x // z + y // z) + ' ' + str(0))
else:
	print(str((x + y) // z) + ' ' + str(min(z - x % z, z - y % z)))


L = list(map(int, input().split()))
a = L[0]
b = L[1]
c = L[2]
coco = (a + b) // c
if a % c + b % c == c:
	co = min(a % c, b % c)
elif a % c + b % c > c:
	co = min(c - a % c, c - b % c)
else:
	co = 0
print(coco, co)


[s, m, c] = list(map(int, input().split()))
tot = str((s + m) // c)
mini = s % c if s % c < m % c else m % c
maxi = s % c if s % c > m % c else m % c
if mini + maxi < c:
	tot = tot + ' 0'
else:
	tot = tot + ' ' + str(c - maxi)
print(tot)


(x, y, z) = input().split()
(x, z, y) = (int(x), int(z), int(y))
if x + y < z:
	print(0, 0)
	exit(0)
if x + y == z:
	print(1, min(x, y))
	exit(0)
f = (x + y) // z
(a, b) = (x % z, y % z)
need = z - max(a, b)
if need <= min(a, b):
	print(f, need)
else:
	print(f, 0)


(x, y, z) = map(int, input().split())
maxco = (x + y) // z
m1 = x // z
m2 = y // z
if m1 + m2 == maxco:
	print(maxco, 0)
else:
	print(maxco, min(z - x % z, z - y % z))


q = 1
for _ in range(q):
	(x, y, z) = map(int, input().split())
	ans = x // z
	ans += y // z
	r1 = x % z
	r2 = y % z
	k = 0
	if r1 + r2 >= z:
		k = min(z - r1, z - r2)
		ans += 1
		print(ans, k)
	else:
		print(ans, 0)


(a, b, c) = map(int, input().split())
a1 = a % c
b1 = b % c
if a1 + b1 < c:
	print(a // c + b // c, 0)
else:
	d = min(c - a1, c - b1)
	print(a // c + b // c + 1, d)


(x, y, z) = map(int, input().split())
num_of_coconuts = x // z + y // z
x %= z
y %= z
if x + y >= z:
	print(num_of_coconuts + 1, end=' ')
	print(z - x if y < x else z - y)
else:
	print(num_of_coconuts, end=' ')
	print(0)


inp = input()
(a, b, c) = map(lambda e: int(e), inp.split(' '))
max_total = (a + b) // c
a_total = a // c
b_total = b // c
if max_total > a_total + b_total:
	a_share = c - a % c
	b_share = c - b % c
	print(max_total, min(a_share, b_share))
else:
	print(max_total, 0)


(n, m, z) = map(int, input().split())
ans = (n + m) // z
if (n + m) // z == n // z + m // z:
	mi = 0
else:
	mi = z - max(n % z, m % z)
print(ans, mi)


(x, y, z) = list(map(int, input().split()))
ans1 = x // z + y // z
x = x % z
y = y % z
if x + y >= z:
	print(ans1 + 1, min(z - x, z - y))
else:
	print(ans1, 0)


(x, y, z) = map(int, input().split())
t = (x + y) // z
x1 = x // z
y1 = y // z
f = 0
if x1 + y1 < t:
	xa = x % z
	ya = y % z
	f = z - max(xa, ya)
else:
	f = 0
print(t, f)


(x, y, z) = map(int, input().split())
if x < y:
	[x, y] = [y, x]
if (x + y) // z == x // z + y // z:
	print((x + y) // z, 0)
	exit()
x1 = x
y1 = y
cnt = 0
if x % z != 0:
	diff = (x // z + 1) * z - x
	y -= diff
	x += diff
	cnt = diff
cnt1 = 0
if y1 % z != 0:
	diff = (y1 // z + 1) * z - y1
	y1 += diff
	x1 -= diff
	cnt1 = diff
if x1 < 0 or y1 < 0:
	cnt1 = 10 ** 20
if x < 0 or y < 0:
	cnt = 10 ** 20
if cnt1 == 10 ** 20 and cnt == 10 ** 20:
	print((x + y) // z, 0)
else:
	print((x + y) // z, min(cnt, cnt1))


(x, y, z) = list(map(int, input().split()))
rs = (x + y) // z
if x % z != 0 and y % z != 0 and (x % z + y % z >= z):
	if x % z + y % z == z:
		c = min(x % z, y % z)
	else:
		c = z - max(x % z, y % z)
else:
	c = 0
print(rs, c)


(A, B, K) = map(int, input().split())
result = (A + B) // K
rem1 = A % K
rem2 = B % K
if rem1 + rem2 < K:
	print(result, 0)
else:
	print(result, min(K - rem1, K - rem2))


(s, m, p) = [int(x) for x in input().split()]
(ch, co) = (0, 0)
x = s // p
y = m // p
co += x + y
s -= p * x
m -= p * y
if s != 0 and m != 0:
	if s + m >= p:
		a = max(s, m)
		ch = p - a
		co += 1
print(str(co) + ' ' + str(ch))


(x, y, z) = list(map(int, input().split()))
if x % z == 0 or y % z == 0:
	print(x // z + y // z, 0)
else:
	a = x - x // z * z
	b = y - y // z * z
	r = z - max(a, b)
	if min(a, b) >= r:
		print(x // z + y // z + 1, r)
	else:
		print(x // z + y // z, 0)


(x, y, z) = [int(x) for x in input().split()]
ans = (x + y) // z
x = x - x // z * z
y = y - y // z * z
if x + y < z:
	print(ans, 0)
	quit()
ans1 = min(z - x, z - y)
print(ans, ans1)


def solve(x, y, z):
	s = (x + y) // z
	c = 0
	(x_rem, y_rem) = (x % z, y % z)
	if x_rem + y_rem >= z:
		c = z - max(x_rem, y_rem)
	print(s, c)
(x, y, z) = map(int, input().split())
solve(x, y, z)


def main():
	(x, y, z) = map(int, input().split())
	t = x // z + y // z
	x %= z
	y %= z
	if x + y < z:
		print(t, 0)
	else:
		t += 1
		o = min(z - x, z - y)
		print(t, o)
main()


def gns():
	return list(map(int, input().split()))
(x, y, z) = gns()
ans = 0
ans += x // z
ans += y // z
x = x % z
y = y % z
if x + y >= z:
	ans += 1
	print(ans, z - max(x, y))
else:
	print(ans, 0)


(x, y, z) = list(map(int, input().split()))
m = (x + y) // z
if x % z + y % z >= z:
	g = min(z - x % z, z - y % z)
else:
	g = 0
print(m, g)


(x, y, z) = list(map(int, input().split()))
ans = (x + y) // z
if x // z + y // z == ans:
	print(ans, 0)
else:
	mul1 = z * (x // z + 1) - x
	mul2 = z * (y // z + 1) - y
	print(ans, min(mul1, mul2))


(x, y, z) = map(int, input().split())
w = (x + y) // z
q = x % z
q1 = y % z
e = min(q, q1)
r = max(q, q1)
a = z - r
if x % z == 0 and y % z == 0:
	print(w, 0)
elif e + r >= z and a <= r:
	print(w, a)
else:
	print(w, 0)


(x, y, z) = list(map(int, input().split()))
a = z - x % z
b = z - y % z
p = x // z + y // z
q = 0
if a <= y:
	p1 = (x + a) // z + (y - a) // z
	if p1 > p:
		(p, q) = (p1, a)
if b < x:
	p2 = (x - b) // z + (y + b) // z
	if p2 > p or (p2 == p and b < q):
		(p, q) = (p2, b)
print(p, q)


(dengi_sashi, dengi_mashi, cena) = map(int, input().split())
kupila_sasha = dengi_sashi // cena
ostalos_u_sashi = dengi_sashi % cena
kupila_masha = dengi_mashi // cena
ostalos_u_mashi = dengi_mashi % cena
ostalos_neispolzovanno = ostalos_u_mashi + ostalos_u_sashi
mogut_eshe_kupit = ostalos_neispolzovanno // cena
ne_mogut_ispolzovat = ostalos_neispolzovanno % cena
if mogut_eshe_kupit >= 1:
	lishnee = min(ostalos_u_mashi, ostalos_u_sashi)
	v_dolg = lishnee - ne_mogut_ispolzovat
	kupili = kupila_sasha + kupila_masha + mogut_eshe_kupit
	print(kupili, v_dolg)
else:
	kupili = kupila_sasha + kupila_masha + mogut_eshe_kupit
	print(kupili, 0)


(x, y, z) = map(int, input().split())
s = (x + y) // z
k = (z - x % z) % z
k1 = (z - y % z) % z
if x // z + y // z == s:
	print(s, 0)
elif min(k, k1) == k:
	if k <= y:
		print(s, k)
	else:
		print(s, 0)
elif k1 <= x:
	print(s, k1)
else:
	print(S, 0)


(x, y, z) = map(int, input().split())
max_num = (x + y) // z
x_num = x // z
y_num = y // z
if max_num == x_num + y_num:
	print(max_num, 0)
else:
	print(max_num, min(z - x % z, z - y % z))


(x, y, z) = map(int, input().split())
f = (x + y) // z
s = 0
if f != x // z + y // z:
	s = z - max(x % z, y % z)
print(f, s)


(x, y, z) = map(int, input().split())
num1 = (x + y) // z
n = x % z
m = y % z
if n + m >= z:
	num2 = min(z - n, z - m)
else:
	num2 = 0
print(num1, num2)


x = input()
y = x.split()
z = [int(d) for d in y]
m = []
r0 = z[0] % z[2]
r1 = z[1] % z[2]
q0 = z[0] // z[2]
q1 = z[1] // z[2]
q2 = (r0 + r1) // z[2]
min = min(z[2] - r0, z[2] - r1)
if q2 == 0:
	m.append(0)
else:
	m.append(min)
c = q0 + q1 + q2
print(c, m[0])


(x, y, z) = map(int, input().split())
k = x // z + y // z
x %= z
y %= z
c = 0
if x + y >= z:
	k += 1
	c = z - max(x, y)
print(k, end=' ')
print(c)


def mp():
	return map(int, input().split())
(a, b, c) = mp()
r = 10 ** 20
if a % c == 0 or b % c == 0:
	r = 0
else:
	mod_a = a % c
	need_a = c - mod_a
	mod_b = b % c
	need_b = c - mod_b
	if mod_a >= need_b:
		r = need_b
	if mod_b >= need_a:
		r = min(r, need_a)
if r == 10 ** 20:
	r = 0
print((a + b) // c, r)


def f(l):
	(x, y, z) = l
	n = (x + y) // z
	d = 0 if x % z + y % z < z else z - 1 - max((x - 1) % z, (y - 1) % z)
	return [n, d]
l = list(map(int, input().split()))
print(*f(l))


(x, y, z) = map(int, input().split())
ans = 0
ans2 = 0
ans += x // z
ans += y // z
x %= z
y %= z
if x + y >= z:
	ans += 1
	ans2 = min(z - x, z - y)
print(ans, ans2)


(x, y, z) = map(int, input().split())
n = (x + y) // z
s = n * z
if n != x // z + y // z:
	ans2 = min(z - x % z, z - y % z)
else:
	ans2 = 0
print(n, ans2)


import sys

def main():
	(x, y, z) = [int(x) for x in sys.stdin.readline().split(' ')]
	total = x // z + y // z
	trade = 0
	r1 = x % z
	r2 = y % z
	if r1 + r2 >= z:
		trade = min(z - r1, z - r2)
		total += 1
	print(total, trade)
main()


class cinn:

	def __init__(self):
		self.x = []

	def cin(self, t=int):
		if len(self.x) == 0:
			a = input()
			self.x = a.split()
			self.x.reverse()
		return self.get(t)

	def get(self, t):
		return t(self.x.pop())

	def clist(self, n, t=int):
		l = [0] * n
		for i in range(n):
			l[i] = self.cin(t)
		return l

	def clist2(self, n, t1=int, t2=int, t3=int, tn=2):
		l = [0] * n
		for i in range(n):
			if tn == 2:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				l[i] = (a1, a2)
			elif tn == 3:
				a1 = self.cin(t1)
				a2 = self.cin(t2)
				a3 = self.cin(t3)
				l[i] = (a1, a2, a3)
		return l

	def clist3(self, n, t1=int, t2=int, t3=int):
		return self.clist2(self, n, t1, t2, t3, 3)

	def cout(self, i, ans=''):
		if ans == '':
			print('Case #' + str(i + 1) + ':', end=' ')
		else:
			print('Case #' + str(i + 1) + ':', ans)

	def printf(self, thing):
		print(thing, end='')

	def countlist(self, l, s=0, e=None):
		if e == None:
			e = len(l)
		dic = {}
		for el in range(s, e):
			if l[el] not in dic:
				dic[l[el]] = 1
			else:
				dic[l[el]] += 1
		return dic

	def talk(self, x):
		print(x, flush=True)

	def dp1(self, k):
		L = [-1] * k
		return L

	def dp2(self, k, kk):
		L = [-1] * k
		for i in range(k):
			L[i] = [-1] * kk
		return L

	def isprime(self, n):
		if n == 1 or n == 0:
			return False
		for i in range(2, int(n ** 0.5 + 1)):
			if n % i == 0:
				return False
		return True

	def factors(self, n):
		from functools import reduce
		return set(reduce(list.__add__, ([i, n // i] for i in range(1, int(n ** 0.5) + 1) if n % i == 0)))

	def nthprime(self, n):
		i = 0
		s = 2
		L = []
		while i < n:
			while not self.isprime(s):
				s += 1
			L.append(s)
			s += 1
			i += 1
		return L

	def matrixin(self, m, n, t=int):
		L = []
		for i in range(m):
			p = self.clist(n, t)
			L.append(p)
		return L

	def seive(self, k):
		n = k + 1
		L = [True] * n
		L[1] = False
		L[0] = False
		for i in range(2, n):
			if L[i] == True:
				for j in range(2 * i, n, i):
					L[j] = False
		return L

	def seiven(self, n, L):
		i = 0
		for j in range(len(L)):
			if L[j] == True:
				i += 1
			if i == n:
				return j
c = cinn()
x = c.cin()
y = c.cin()
z = c.cin()
o1 = x % z
o2 = y % z
coc = x // z + y // z
given = 0
if o1 + o2 >= z:
	giver = min(o1, o2)
	given = z - max(o1, o2)
	coc += 1
print(coc, given)


(X, Y, Z) = map(int, input().split())
Max = (X + Y) // Z
if X // Z + Y // Z == Max:
	print(Max, 0)
else:
	a = Z - (X - X // Z * Z)
	b = Z - (Y - Y // Z * Z)
	print(Max, min(a, b))


(x, y, z) = map(int, input().split(' '))
if x % z + y % z >= z:
	print(x // z + y // z + 1, z - max([x % z, y % z]))
else:
	print(x // z + y // z, 0)


(x, y, z) = map(int, input().split())
s = (x + y) // z
m = (x + y) % z
print(s, max(min(x % z - m, y % z - m), 0))


(x, y, z) = map(int, input().split())
coconuts = (x + y) // z
a = (x // z + 1) * z - x
b = (y // z + 1) * z - y
if x // z + y // z == coconuts:
	money = 0
elif a <= b and b < z:
	money = a
elif b < a and a < z:
	money = b
else:
	money = 0
print(coconuts, money)


(z, y, x) = map(int, input().split())
carry = 0
if (y % x > 0 and z % x > 0) and y % x + z % x >= x:
	carry = x - max([y % x, z % x])
print(str((y + z) // x) + ' ' + str(carry))


from collections import Counter
import copy

def solve():
	(a, b, c) = list(map(int, input().split()))
	if a % c == 0 and b % c == 0:
		print(a // c + b // c, 0)
		return
	ra = a % c
	rb = b % c
	purchased = a // c + b // c
	if ra <= rb:
		need = c - rb
		if ra >= c - rb:
			purchased += 1
			print(purchased, c - rb)
		else:
			print(purchased, 0)
	else:
		need = c - ra
		if rb >= c - ra:
			purchased += 1
			print(purchased, c - ra)
		else:
			print(purchased, 0)
solve()


(x, y, z) = map(int, input().split(' '))
rem1 = x % z
rem2 = y % z
t_coco = x // z + y // z + (rem1 + rem2) // z
minimum = min(rem1, rem2)
k = (rem1 + rem2) % z
if minimum >= k:
	l = minimum - k
else:
	l = 0
print(t_coco, l)


(x, y, z) = [int(x) for x in input().split()]
a = x // z + y // z
b = 0
x = x - x // z * z
y = y - y // z * z
if x + y == z:
	a = a + 1
	b = min(x, y)
elif x + y > z:
	a = a + 1
	b = z - max(x, y)
print(a, b)


(x, y, z) = map(int, input().split())
o = x // z
t = y // z
r1 = x % z
r2 = y % z
if r1 + r2 >= z:
	print(o + t + 1, z - max(r1, r2))
else:
	print(o + t, 0)


def factorial(n):
	if n == 1:
		return 1
	if n == 0:
		return 1
	return n * factorial(n - 1)

def cnk(n, k):
	if k > n:
		return 0
	return factorial(n) / (factorial(n - k) * factorial(k))

def main():
	(x, y, z) = map(int, input().split())
	result = 0
	x_max = x // z
	y_max = y // z
	result += x_max
	result += y_max
	result1 = 0
	x %= z
	y %= z
	if x + y >= z:
		result += 1
		result1 += min(z - y, z - x)
	print(result, result1)
main()


import sys

class AChungaChanga:

	def __init__(self):
		self.t = 0

	def solve(self):
		(x, y, z) = [int(_) for _ in input().split()]
		res = [-float('inf'), float('inf')]
		for i in range(2):
			(x, y) = (y, x)
			yleft = z - y % z
			if x % z >= yleft:
				v = x // z + (y + x % z) // z
				if v >= res[0] and yleft < res[1]:
					res = [x // z + (y + x % z) // z, yleft]
			else:
				v = x // z + y // z
				if v >= res[0] and yleft < res[1]:
					res = [x // z + y // z, 0]
		print(*res)
solver = AChungaChanga()
input = sys.stdin.readline
solver.solve()


(x, y, z) = map(int, input().split())
b = (x + y) // z
l = (x + y) % z
p = x % z
if p != 0:
	p = z - p
q = y % z
if q != 0:
	q = z - q
if x % z + y % z >= z:
	print(b, end=' ')
	print(min(p, q))
else:
	b = x // z + y // z
	print(b, end=' ')
	print(0)


(x, y, z) = list(map(int, input().split()))
a = (x + y) // z
b = (x + y) % z
res = max(min(x % z - b, y % z - b), 0)
print(a, res)


(x, y, z) = map(int, input().split())
x1 = x % z
x2 = x // z
y1 = y % z
y2 = y // z
if x1 + y1 >= z:
	print(x2 + y2 + 1, z - max(x1, y1))
else:
	print(x2 + y2, 0)


(x, y, z) = map(int, input().split())
if x % z + y % z >= z:
	t = x % z + y % z - z
	d = min(abs(x % z - t), abs(y % z - t))
else:
	d = 0
print((x + y) // z, d)


(x, y, z) = map(int, input().split())
count = (x + y) // z
h = x // z
h1 = y // z
if count == h + h1:
	print(count, 0)
else:
	print(count, min(z - (x - h * z), z - (y - h1 * z)))


(x, y, z) = [int(s) for s in input().split(' ')]
c = (x + y) // z
e = min(z - x % z, z - y % z) * int(x % z + y % z >= z)
print(c, e)


(x, y, a) = map(int, input().split())
mxbuy = (x + y) // a
x = x % a
y = y % a
if x + y >= a:
	r = min(a - x, a - y)
	print(mxbuy, r)
else:
	print(mxbuy, 0)


import sys

def ints():
	return list(map(int, sys.stdin.readline().strip().split()))
tc = 1
while tc:
	tc -= 1
	(n, m, k) = map(int, input().split())
	if n % k + m % k < k:
		s = 0
	else:
		s = min(n % k, m % k)
	print((n + m) // k, min(k - max(n % k, m % k), s))


abc = input()
(a, b, c) = abc.split()
a = int(a)
b = int(b)
c = int(c)
total = (a + b) // c
exchange = min(a % c, b % c, c - a % c, c - b % c)
if a // c + b // c == total:
	exchange = 0
print(total, exchange)


(x, y, z) = map(int, input().split())
s = x // z
m = y // z
ex = x - s * z
ey = y - m * z
ans = (x + y) // z
if ex + ey >= z:
	print(ans, min(z - ex, z - ey))
else:
	print(ans, 0)


(x, y, z) = map(int, input().split())
o = x // z + y // z
x = x % z
y = y % z
o2 = 0
if (x + y) % z != x + y:
	o += 1
	if x > y:
		o2 = z - x
	else:
		o2 = z - y
print(o, o2)


from math import *
(x, y, z) = map(int, input().split(' '))
tot = x // z
x = x % z
tot += y // z
y = y % z
s = 0
if x + y >= z:
	tot += 1
	s = min(z - y, z - x)
print(tot, s)


(x, y, z) = map(int, input().split())
a1 = x % z
b1 = y % z
a2 = x // z
b2 = y // z
if a1 + b1 < z:
	print(a2 + b2, end=' ')
	print(0)
else:
	print(a2 + b2 + 1, end=' ')
	if a1 < b1:
		print(z - b1)
	else:
		print(z - a1)


(x, y, z) = list(map(int, input().split()))
maxC = (x + y) // z
ostX = x % z
ostY = y % z
minC = 0
if (ostX + ostY) // z > 0:
	needX = z - ostX
	needY = z - ostY
	minC = min(needX, needY)
print(str(maxC) + ' ' + str(minC))


(x, y, z) = map(int, input().split())
m = (x + y) // z
m = int(m)
if x % z + y % z >= z:
	h = min(z - x % z, z - y % z)
else:
	h = 0
print(m, h)


x = input().split()
a = int(x[0])
b = int(x[1])
c = int(x[2])
if a % c + b % c < c or b % c + a % c < c:
	d = 0
elif a + b < c or a % c == 0 or b % c == 0:
	d = 0
elif a % c > b % c:
	d = c - a % c
else:
	d = c - b % c
print((a + b) // c, d % c)


import sys
import math
input = sys.stdin.readline

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

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

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

def invr():
	return map(int, input().split())
(x, y, z) = invr()
tot = (x + y) // z
a = x // z
b = y // z
if a + b != tot:
	ans = min(z - x % z, z - y % z)
	print(tot, ans)
else:
	print(tot, 0)


(x, y, z) = map(int, input().strip().split())
if (x + y) // z == x // z + y // z:
	print((x + y) // z, 0)
else:
	(x1, y1) = (x % z, y % z)
	print((x + y) // z, min(z - x1, z - y1))


(kchm, kchs, koks) = map(int, input().split())
k = (kchm + kchs) // koks
if k == 0:
	print(0, 0)
else:
	obmen = min(kchm % koks, kchs % koks)
	kchm = kchm % koks
	kchs = kchs % koks
	(kchm, kchs) = (max(kchm, kchs), min(kchm, kchs))
	if kchs + kchm == koks:
		print(k, obmen)
	elif kchs + kchm < koks:
		print(k, 0)
	else:
		print(k, koks - kchm)


(m, s, c) = map(int, input().split())
r = (m + s) // c
p = (m + s) % c
t = m % c
q = s % c
if t + q >= c:
	print(r, min(t, q) - p)
else:
	print(r, 0)


(x, y, z) = map(int, input().split())
s = x // z + y // z
t = 0
if x % z + y % z >= z:
	p = (x % z + y % z) // z
	t = p * z - max(x % z, y % z)
	s += p
print(s, t)


T = list(map(int, input().split()))
print((T[0] + T[1]) // T[2], max(min(T[0] % T[2], T[1] % T[2]) - (T[0] + T[1]) % T[2], 0))


(x, y, a) = map(int, input().split())
(s, t) = (x % a, y % a)
mn = min(s, t)
mn = min(mn, min(a - s if a - s <= y else 10 ** 24, a - t if a - t <= x else 10 ** 24))
print((x + y) // a, mn if x // a + y // a != (x + y) // a else 0)


(x, y, z) = map(int, input().split())
r1 = x % z
r2 = y % z
t = (x + y) // z
q = 0
if r1 > r2:
	if z - r1 <= r2:
		q = z - r1
elif z - r2 <= r1:
	q = z - r2
print(t, q)


(x, y, z) = list(map(int, input().split(' ')))
c = x // z + y // z
x = x % z
y = y % z
if x + y == z:
	m = min(x, y)
elif x + y > z:
	m = z - max(x, y)
else:
	m = 0
	c -= 1
print(c + 1, m)


(a, b, c) = map(int, input().split())
k = a // c + b // c
a = a % c
b = b % c
k2 = 0
if a + b >= c:
	k2 = c - max(a, b)
if k2:
	k += 1
print(k, k2)


(x, y, z) = map(int, input().split())
num = 0
debt = 0
if x % z + y % z >= z:
	num += x // z
	num += y // z
	num += 1
	if x % z < y % z:
		debt += z - y % z
	else:
		debt += z - x % z
else:
	num += x // z
	num += y // z
print(str(num) + ' ' + str(debt))


(x, y, z) = map(int, input().split(' '))
if (x + y) // z > x // z + y // z:
	s = str((x + y) // z) + ' ' + str(min((x // z + 1) * z - x, (y // z + 1) * z - y))
else:
	s = str((x + y) // z) + ' 0'
print(s)


(x, y, z) = map(int, input().split())
if x % z == 0 or y % z == 0:
	coco = int(x // z + y // z)
	curr = 0
	print(coco, curr)
else:
	modx = x % z
	mody = y % z
	dx = z - modx
	dy = z - mody
	if dx < dy:
		coco = (x + dx) // z + (y - dx) // z
		curr = dx
		if coco <= int(x // z + y // z):
			print(int(x // z + y // z), 0)
		else:
			print(int(coco), curr)
	else:
		coco = (y + dy) // z + (x - dy) // z
		curr = dy
		if coco <= int(x // z + y // z):
			print(int(x // z + y // z), 0)
		else:
			print(int(coco), curr)


(x, y, z) = list(map(int, input().split()))
max_c = (x + y) // z
e_1 = x % z
e_2 = y % z
ex = 0
if e_1 + e_2 >= z:
	ex = min(z - e_1, z - e_2)
print(max_c, ex)


(x, y, z) = map(int, input().split())
a = x // z
b = y // z
c = (x + y) // z
if a + b == c:
	print(c, 0)
else:
	ost_a = x % z
	ost_b = y % z
	if ost_a > ost_b:
		print(c, z - ost_a)
	else:
		print(c, z - ost_b)


p = input().rstrip().split(' ')
A = int(p[0])
X = A
B = int(p[1])
T = B
C = int(p[2])
if A % C == 0 and B % C == 0:
	print(A // C + B // C, 0)
else:
	aa = 0
	a = A // C + B // C
	b = A // C + 1
	c = C * b - A
	if c <= B:
		B = B - c
		A = A + c
		b = A // C + B // C
		bb = c
		if b > a:
			a = b
			aa = bb
	f = (T // C + 1) * C - T
	if f <= X:
		X = X - f
		T += f
		c = T // C + X // C
		cc = f
		if c > a:
			a = c
			aa = cc
		elif c == a:
			if cc < aa:
				aa = cc
	print(a, aa)


(x, y, z) = map(int, input().split())
num = x // z + y // z
cx = x % z
cy = y % z
if cx + cy >= z:
	num += (cx + cy) // z
	given = z - max(cx, cy)
else:
	given = 0
print(num, given)


(x, y, z) = map(int, input().split())
r1 = x % z
r2 = y % z
ans = (x + y) // z
t1 = 0
c = min(r1, r2)
if r1 + r2 < z:
	t1 = 0
elif r1 >= r2:
	t1 = z - r1
else:
	t1 = z - r2
print(ans, t1)


I = lambda : map(int, input().split())
(x, y, z) = I()
ans = (x + y) // z
t1 = x % z
t2 = y % z
if t1 + t2 < z:
	ans2 = 0
else:
	ans2 = min(z - t1, z - t2)
print(ans, ans2)


ln = [int(i) for i in input().split(' ')]
a = ln[0]
b = ln[1]
p = ln[2]
cc = (a + b) // p
d = -1
if p - a % p < p - b % p:
	if p - a % p > b % p:
		d = 0
	else:
		d = p - a % p
elif p - b % p > a % p:
	d = 0
else:
	d = p - b % p
print(cc, d)


(x, y, n) = map(int, input().split())
m = x // n + y // n
(xx, yy) = (x % n, y % n)
s = xx + yy
m = m + s // n
if s >= n:
	print(m, min(n - xx, n - yy))
else:
	print(m, 0)


(x, y, z) = map(int, input().split())
ans = x // z
ans += y // z
x = x - x // z * z
y = y - y // z * z
bor = 0
if x != 0 and y != 0:
	mx = max(x, y)
	t = mx % z
	t = z - t
	if t <= min(x, y):
		bor = t
		ans += 1
print(ans, bor)


(a, b, c) = map(int, input().split())
t = (a + b) // c
tz = (a + b) % c
print(t, max(min(a % c - tz, b % c - tz), 0))


(a, b, c) = map(int, input().split())
x = a % c
x1 = a // c
y = b % c
y1 = b // c
print(x1 + y1 + (x + y) // c, end=' ')
l = 0
if x + y >= c:
	l = c - max(x, y)
print(l)


(x, y, z) = map(int, input().split())
(d1, m1, d2, m2) = (x // z, x % z, y // z, y % z)
if m1 + m2 >= z:
	print(d1 + d2 + 1, min(z - m1, z - m2))
else:
	print(d1 + d2, 0)


(x, y, z) = map(int, input().split())
count = 0
count += (x + y) // z
a = x % z
b = y % z
c = (x + y) // z - (x // z + y // z)
if c > 0:
	print(str(count) + ' ' + str(c * z - max(a, b)))
else:
	print(str(count) + ' ' + str(0))


[x, y, z] = map(int, input().split())
xleft = x % z
yleft = y % z
if xleft + yleft >= z:
	print(x // z + y // z + 1, min(z - xleft, z - yleft))
else:
	print(x // z + y // z, 0)


(n, m, k) = map(int, input().split())
a = n % k
if a:
	a = k - a
b = m % k
if b:
	b = k - b
if (n + a) // k + (m - a) // k > (n - b) // k + (m + b) // k:
	if (n + a) // k + (m - a) // k == n // k + m // k:
		print((n + a) // k + (m - a) // k, 0)
	else:
		print((n + a) // k + (m - a) // k, a)
elif (n + a) // k + (m - a) // k == (n - b) // k + (m + b) // k:
	if (n + a) // k + (m - a) // k == n // k + m // k:
		print(n // k + m // k, 0)
	elif a > b:
		print((n - b) // k + (m + b) // k, b)
	else:
		print((n - b) // k + (m + b) // k, a)
elif n // k + m // k == (n - b) // k + (m + b) // k:
	print((n - b) // k + (m + b) // k, 0)
else:
	print((n - b) // k + (m + b) // k, b)


(x, y, z) = map(int, input().split())
d = 0
d += x // z
d += y // z
x = x % z
y = y % z
if x + y >= z:
	print(d + 1, min(z - x, z - y))
else:
	print(d, 0)


from sys import stdin, stdout
from math import floor, gcd, fabs, factorial, fmod, sqrt, inf, log
from collections import defaultdict as dd, deque
from heapq import merge, heapify, heappop, heappush, nsmallest
from bisect import bisect_left as bl, bisect_right as br, bisect
mod = pow(10, 9) + 7
mod2 = 998244353

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

def iinp():
	return int(inp())

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

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

def lmp():
	return list(mp())

def mp():
	return map(int, inp().split())

def smp():
	return map(str, inp().split())

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

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

def remadd(x, y):
	return 1 if x % y else 0

def ceil(a, b):
	return (a + b - 1) // b
S1 = 'abcdefghijklmnopqrstuvwxyz'
S2 = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'

def isprime(x):
	if x <= 1:
		return False
	if x in (2, 3):
		return True
	if x % 2 == 0:
		return False
	for i in range(3, int(sqrt(x)) + 1, 2):
		if x % i == 0:
			return False
	return True
(a, b, c) = mp()
d = a % c
e = b % c
print((a + b) // c, min(d, e, c - d, c - e) if (a + b) // c > a // c + b // c else 0)


try:
	(x, y, z) = map(int, input().split())
	s1 = x % z
	s2 = y % z
	k1 = x // z + y // z
	if s1 and s2 == 0:
		print(x // z + y // z, '0')
	elif s1 < s2:
		l = z - s2
		x = x - l
		y = y + l
		k = x // z + y // z
		if k == k1:
			print(k, '0')
		else:
			print(k, l)
	elif s2 < s1:
		l = z - s1
		y = y - l
		x = x + l
		k = x // z + y // z
		if k == k1:
			print(k, '0')
		else:
			print(k, l)
	else:
		s = z - s1
		y = y + s
		x = x - s
		k = x // z + y // z
		if k == k1:
			print(k, '0')
		else:
			print(k, s)
except:
	pass


l = input().split()
(x, y, z) = (int(l[0]), int(l[1]), int(l[2]))
quotient = (x + y) // z
take = 0
if x % z + y % z >= z:
	max_rem = max(x % z, y % z)
	take = z - max_rem
print(quotient, take)


lst = input().split()
a = int(lst[0])
b = int(lst[1])
c = int(lst[2])
if a % c == 0 or b % c == 0:
	print(a // c + b // c, 0)
else:
	d = min(min(a % c, c - a % c), min(b % c, c - b % c))
	res = max((a + d) // c + (b - d) // c, (a - d) // c + (b + d) // c)
	if res == a // c + b // c:
		print(res, 0)
	else:
		print(max((a + d) // c + (b - d) // c, (a - d) // c + (b + d) // c), d)


(x, y, z) = [int(k) for k in input().split()]
nuts_x = x // z
nuts_y = y // z
over_x = x % z
over_y = y % z
short_x = z - over_x
short_y = z - over_y
if over_x + over_y < z:
	print('{} {}'.format(nuts_x + nuts_y, 0))
else:
	print('{} {}'.format(nuts_x + nuts_y + 1, min(short_x, short_y)))


(x, y, z) = map(int, input().split())
ans1 = (x + y) // z
n = z - x % z
n1 = z - y % z
if x // z + y // z == ans1:
	print(ans1, 0)
else:
	ans2 = min(n * int(not n == z), n1 * int(not n1 == z))
	print(ans1, ans2)


(x, y, z) = input().strip().split(' ')
(x, y, z) = [int(x), int(y), int(z)]
p = x % z
q = y % z
r = x // z + y // z
rt = (p + q) // z
if rt > 0:
	if p > q:
		ty = (x // z + 1) * z - x
		print(r + rt, ty)
	else:
		ty = (y // z + 1) * z - y
		print(r + rt, ty)
else:
	print(r + rt, 0)


(x, y, z) = map(int, input().split())
M = (x + y) // z
first = x % z
second = y % z
new_first = first - z
new_second = second - z
s = []
if M > x // z + y // z:
	if y >= abs(new_first):
		s.append(abs(new_first))
	if x >= abs(new_second):
		s.append(abs(new_second))
	if y >= second:
		s.append(second)
	if x >= first:
		s.append(first)
	print(M, min(s))
else:
	print(x // z + y // z, 0)


buff = input().split()
sum1 = int(buff[0])
sum2 = int(buff[1])
price = int(buff[2])
totalcocos = 0
totalcocos += sum1 // price
sum1 -= totalcocos * price
totalcocos2 = sum2 // price
sum2 -= totalcocos2 * price
totalcocos += totalcocos2
need = 0
mn = min(sum1, sum2)
mx = max(sum1, sum2)
if mn + mx >= price:
	need = price - mx
	totalcocos += 1
print(totalcocos, need)


(x, y, z) = map(int, input().split())
a = (x + y) // z
ax = x // z
ay = y // z
b = 0
if ax + ay != a:
	b = min((ax + 1) * z - x, (ay + 1) * z - y)
print(a, b)


(n1, n2, n3) = input().split()
n1 = int(n1)
n2 = int(n2)
n3 = int(n3)
count = n1 // n3
count += n2 // n3
n1 = n1 % n3
n2 = n2 % n3
if n1 + n2 < n3:
	print(count, 0)
else:
	if n2 > n1:
		(n1, n2) = (n2, n1)
	print(count + 1, n3 - n1)


(x, y, z) = map(int, input().split())
(rx, ry, cnt) = (x % z, y % z, x // z + y // z)
if rx + ry < z:
	print(cnt, 0)
else:
	print(cnt + 1, z - rx if rx > ry else z - ry)


import math as mt
import sys, string, bisect
input = sys.stdin.readline
from collections import deque, defaultdict
L = lambda : list(map(int, input().split()))
Ls = lambda : list(input().split())
M = lambda : map(int, input().split())
I = lambda : int(input())
(x, y, z) = M()
ans = (x + y) // z
if z - x % z > y % z:
	if z - y % z > x % z:
		print(ans, 0)
	else:
		print(ans, x % z)
elif z - y % z > x % z:
	print(ans, y % z)
else:
	print(ans, min(z - x % z, z - y % z))


(a, b, c) = map(int, input().split())
f = c - max(a % c, b % c)
if f > min(a % c, b % c):
	f = 0
print(a // c + b // c + (a % c + b % c) // c, f)


from sys import stdin, stdout
from itertools import combinations
from collections import defaultdict
import math
import heapq

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

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

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

def stringIn():
	return stdin.readline().strip()
(x, y, z) = listIn()
total = x // z + y // z
rem_x = x % z
rem_y = y % z
if rem_x + rem_y >= z:
	c = (rem_x + rem_y) // z
	m = min(z * c - rem_x, z * c - rem_y)
else:
	m = 0
	c = 0
print(total + c, m)


def chunga_changa(x, y, z):
	if z == 1:
		return (x + y, 0)
	(p1, p2) = (x // z + y // z, 0)
	if x % z + y % z >= z:
		p1 += 1
		p2 = min(abs(z - x % z), abs(z - y % z))
	return (p1, p2)
(X, Y, Z) = [int(i) for i in input().split()]
print(*chunga_changa(X, Y, Z))


(x, y, z) = map(int, input().split())
c = (x + y) // z
if x % z == 0:
	print(c, 0)
elif y % z == 0:
	print(c, 0)
else:
	d = x % z
	e = y % z
	f = max(e, d)
	j = min(e, d)
	if x % z > y % z:
		b = x - d
		n = y + d
	else:
		b = x + e
		n = y - e
	if b % z + n % z >= e + d:
		print(c, 0)
	else:
		print(c, z - f)


xyz = input()
xyz = xyz.split()
x = eval(xyz[0])
y = eval(xyz[1])
z = eval(xyz[2])
sl = (x + y) // z
if x // z + y // z == sl:
	td = 0
elif z - x % z <= z - y % z:
	td = z - x % z
else:
	td = z - y % z
print(sl, td)


from collections import defaultdict
import bisect
from itertools import accumulate
import os
import sys
import math
from decimal import *
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))

def input():
	return sys.stdin.readline().rstrip('\r\n')
(x, y, z) = map(int, input().split())
total = x // z + y // z
if total == (x + y) // z:
	print(total, 0)
else:
	print(total + 1, min(z - x % z, z - y % z))


(x, y, z) = list(map(int, input().split()))
print((x + y) // z, max(min(x % z, y % z) - (x + y) % z, 0))


(x, y, z) = map(int, input().split())
if x % z == 0:
	print(x // z + y // z, 0)
else:
	r = y % z
	p = x % z
	if r + p >= z:
		c = min(z - p, z - r)
	else:
		c = 0
	print(x // z + y // z + (x % z + y % z) // z, c)


(a, b, c) = map(int, input().split())
res = (a + b) // c
if res == 0:
	print(res, 0)
else:
	re1 = a % c
	re2 = b % c
	re = re1 + re2
	if re >= c:
		fi1 = c - re1
		fi2 = c - re2
		print(res, min(fi1, fi2))
	else:
		print(res, 0)


(x, y, z) = map(int, input().split(' '))
res1 = (x + y) // z
x %= z
y %= z
res2 = 0
if x + y >= z:
	res2 = min(z - x, z - y)
print(res1, res2)


(n, m, k) = map(int, input().split())
s = (n + m) // k
(o1, o2) = (n % k, m % k)
print(s, k - max(o1, o2) if o1 + o2 >= k else 0)


(x, y, z) = map(int, input().split())
t = (x + y) // z
p = x // z
h = y // z
if t == p + h:
	print(t, 0)
else:
	print(t, min(z - x % z, z - y % z))


(x, y, z) = map(int, input().split(' '))
res = 0
res += x // z + y // z
rem1 = x % z
rem2 = y % z
if rem1 + rem2 >= z:
	res += 1
	if rem1 > rem2:
		(rem1, rem2) = (rem2, rem1)
	print('{} {}'.format(res, z - rem2))
else:
	print('{} {}'.format(res, 0))


(x, y, z) = map(int, input().split())
print((x + y) // z, end=' ')
X = x % z
Y = y % z
if X + Y >= z:
	print(z - max(X, Y))
else:
	print(0)


(x, y, z) = map(int, input().split())
q = (x + y) // z
dx = x % z
dy = y % z
if dx == 0 or dy == 0 or dx + dy < z:
	s = 0
else:
	s = min(z - dx, z - dy)
print(q, s)


(a, b, k) = map(int, input().split())
ans = a // k + b // k
(resta, restb) = (a % k, b % k)
if resta + restb >= k:
	giving = k - max(resta, restb)
	print(ans + 1, giving)
else:
	print(ans, 0)


temp = input().split()
x = int(temp[0])
y = int(temp[1])
z = int(temp[2])
output = [0, 0]
output[0] = (x + y) // z
x = x % z
y = y % z
if x + y < z:
	output[1] = 0
else:
	output[1] = z - max(x, y)
print(output[0], output[1])


a = list(map(int, input().strip().split()))
(x, y, z) = (a[0], a[1], a[2])
r = (x + y) // z
s = x % z
t = y % z
if s + t >= z:
	u = z - max(s, t)
else:
	u = 0
print(str(r) + ' ' + str(u))


[x, y, z] = [int(c) for c in input().split()]
res = 0
if (x + y) // z > x // z + y // z:
	res = min(x % z, y % z, (z - y) % z, (z - x) % z)
print((x + y) // z, res)


a = input().split()
x = int(a[0])
y = int(a[1])
z = int(a[2])
print((x + y) // z, end=' ')
if x // z + y // z == (x + y) // z:
	print(0)
else:
	print(min(z - x % z, z - y % z))


(x, y, price) = map(int, input().split())
total = (x + y) // price
if total == 0:
	print(f'0 0')
else:
	temp = x // price + y // price
	if total != temp:
		remain1 = x % price
		remain2 = y % price
		use = max(remain1, remain2)
		extra = price - use
		print(f'{total} {extra}')
	else:
		print(f'{total} 0')


import math

def main():
	(n, m, k) = map(int, input().split())
	if (n + m) // k == n // k + m // k:
		print((n + m) // k, 0)
	else:
		temp = (n + m) // k - n // k - m // k
		print((n + m) // k, min(temp * k - n % k, temp * k - m % k))
main()


from collections import *
from math import *
from sys import *
(n, m, k) = map(int, input().split())
x = (n + m) // k
flag = 1
if n // k + m // k == x:
	flag = 0
if n % k == 0 or flag == 0:
	u = 0
else:
	u = k - n % k
if m % k == 0 or flag == 0:
	v = 0
else:
	v = k - m % k
y = min(u, v)
print(x, y)


(x, y, z) = list((int(a) for a in input().split()))
ox = x % z
oy = y % z
x //= z
y //= z
if ox < oy:
	y += (ox + oy) // z
else:
	x += (ox + oy) // z
print(x + y, 0 if ox + oy < z else z - max(ox, oy))


(x, y, z) = list(map(int, input().split()))
can_buy = x // z
can_buy += y // z
x %= z
y %= z
ans = 0
if x + y >= z:
	can_buy += 1
	ans = z - max(x, y)
print('{} {}'.format(can_buy, ans))


a = list(map(int, input().split()))
x = a[0]
y = a[1]
z = a[2]
transfer = 0
sum = 0
sum += x // z + y // z
x -= x // z * z
y -= y // z * z
if x + y >= z:
	sum += (x + y) // z
	mod = (x + y) % z
	if x < y:
		transfer = x - mod
	else:
		transfer = y - mod
print('{} {}'.format(sum, transfer))


(x, y, z) = map(int, input().split())
a = (x + y) // z
b = x // z + y // z
print(a, min(z - x % z, z - y % z) * (b < a))


import sys
import math
input = sys.stdin.readline
(x, y, z) = map(int, input().split())
maxx = (x + y) // z
b = x // z + y // z
if maxx == b:
	print(maxx, 0)
else:
	print(maxx, min(x % z, y % z, z - x % z, z - y % z))


(x, y, z) = map(int, input().split())
val1 = x % z
val2 = y % z
sumx = x + y
ans1 = sumx // z
if val1 + val2 < z:
	ans2 = 0
elif val1 >= val2:
	ans2 = z - val1
else:
	ans2 = z - val2
print(ans1, ans2)


(x, y, z) = map(int, input().split())
ost1 = x % z
ost2 = y % z
k = x // z + y // z
if ost1 + ost2 >= z:
	print((x + y) // z, min((z - ost1) % z, (z - ost2) % z))
else:
	print((x + y) // z, 0)


inp = input().split(' ')
inp = list(map(int, inp))
res = int(inp[0] // inp[2]) + int(inp[1] // inp[2])
inp[0] = inp[0] - int(inp[0] // inp[2]) * inp[2]
inp[1] = inp[1] - int(inp[1] // inp[2]) * inp[2]
if inp[0] + inp[1] >= inp[2]:
	print(res + 1, inp[2] - max(inp[0], inp[1]))
else:
	print(res, 0)


(x, y, z) = map(int, input().split())
re1 = x % z
re2 = y % z
no = x // z + y // z
if re1 + re2 < z:
	print(str(no) + ' 0')
elif re1 >= re2:
	res = z - re1
	no = no + 1
	print(str(no) + ' ' + str(res))
else:
	res = z - re2
	no = no + 1
	print(str(no) + ' ' + str(res))


import sys

def rint():
	return map(int, sys.stdin.readline().split())
(x, y, z) = rint()
x_r = x % z
y_r = y % z
xb = 10 ** 19
yb = 10 ** 19
if z - x_r <= y_r:
	xb = z - x_r
if z - y_r <= x_r:
	yb = z - y_r
add = 0
ans2 = 0
if xb < 10 ** 19 or yb < 10 ** 19:
	add += 1
	ans2 = min(xb, yb)
print(x // z + y // z + add, ans2)


mod = 1000000007
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())
(n, m, k) = f()
mx = (m + n) // k
if n // k + m // k == mx:
	print(mx, 0)
else:
	print(mx, min(k - n % k, k - m % k))


(x, y, z) = [int(i) for i in input().split()]
rx = x % z
ry = y % z
qt = 0
if rx > ry:
	if ry >= z - rx:
		y -= z - rx
		x += z - rx
		qt = z - rx
elif rx >= z - ry:
	x -= z - ry
	y += z - ry
	qt = z - ry
print(x // z + y // z, qt)


(x, y, z) = map(int, input().split())
sum = (x + y) // z
i1 = x // z
i2 = y // z
x = x % z
y = y % z
current = i1 + i2
nu = 0
if current == sum:
	print(sum, end=' ')
	print(nu)
else:
	if x > y:
		h = x
	else:
		h = y
	current = sum - current
	current = current * z
	nu = current - h
	print(sum, end=' ')
	print(nu)


(x, y, z) = map(int, input().split())
res1 = x % z
res2 = y % z
if res1 + res2 < z:
	print((x + y) // z, 0)
else:
	print((x + y) // z, z - max(res1, res2))


(x, y, z) = map(int, input().split())
c1 = x % z
c2 = y % z
c3 = (x + y) // z
print(c3, end=' ')
if x // z + y // z == c3:
	print(0)
else:
	print(min(z - c1, z - c2))


(x, y, z) = map(int, input().split())
o_x = x % z
o_y = y % z
if o_x == 0 and o_y == 0:
	print(x // z + y // z, 0)
elif (o_x + o_y) // z == 1:
	print((x + y) // z, z - max(o_x, o_y))
else:
	print(x // z + y // z, 0)


(a, b, c) = map(int, input().split())
ans = (a + b) // c
if ans - a // c - b // c == 0:
	print(ans, 0)
	exit()
bb = b % c
a_reqd = -1
if a % c == 0:
	a_reqd = 0
else:
	a_reqd = c - a % c
aa = a % c
b_reqd = -1
if b % c == 0:
	b_reqd = 0
else:
	b_reqd = c - b % c
if a_reqd > bb:
	print(ans, min(b_reqd, aa))
elif b_reqd > aa:
	print(ans, min(a_reqd, bb))
else:
	print(ans, min(min(a_reqd, bb), min(b_reqd, aa)))


(x, y, z) = map(int, input().split())
res = x // z + y // z
(a, b) = (x % z, y % z)
if a + b >= z:
	res += (a + b) // z
else:
	print(res, 0)
	quit()
print(res, z - max(a, b))


t = 1
for test in range(t):
	(x, y, z) = list(map(int, input().split()))
	leftx = x - x // z * z
	lefty = y - y // z * z
	a = x // z + y // z
	b = 0
	if (leftx + y) // z > y // z:
		a = max(a, (leftx + y) // z + x // z)
		b = z - (y - y // z * z)
	if (lefty + x) // z > x // z:
		if (lefty + x) // z + y // z > a:
			b = z - (x - x // z * z)
			a = (lefty + x) // z + y // z
		elif (lefty + x) // z + y // z == a:
			b = min(b, z - (x - x // z * z))
	print(a, b)


(m1, m2, cocos) = map(int, input().split())
if m1 % cocos > m2 % cocos:
	res1 = m2
	sobran1 = m2 % cocos
	res2 = m1
	sobran2 = m1 % cocos
else:
	res1 = m1
	sobran1 = m1 % cocos
	res2 = m2
	sobran2 = m2 % cocos
total = 0
if sobran2 + sobran1 >= cocos:
	total = cocos - sobran2
print((m1 + m2) // cocos, total)


from sys import stdin as si
(x, y, z) = map(int, si.readline().split())
rx = x % z
ry = y % z
if rx + ry >= z:
	interc = z - max(rx, ry)
else:
	interc = 0
print((x + y) // z, interc)


(x, y, z) = map(int, input().split())
n = (x + y) // z
a = x % z
b = y % z
c = 0
e = max(a, b)
if a + b >= z:
	c = c + z - e
print(n, c)


A = list(map(int, input().split()))
maxco = int((A[0] + A[1]) // A[2])
diff = maxco - int(A[0] // A[2]) - int(A[1] // A[2])
if diff == 0:
	print(maxco, 0)
else:
	tranf = min(A[2] - A[1] % A[2], A[2] - A[0] % A[2])
	print(maxco, tranf)


(x, y, z) = map(int, input().split())
r1 = x % z
r2 = y % z
p1 = r2 + r1
extra1 = p1 % z
total = p1 - extra1
k1 = total - r1
k2 = total - r2
print(x // z + y // z + (r1 + r2) // z, max(0, min(k1, k2)))


def fun(x, y, z):
	fst = (x + y) // z
	snd = min(z - x % z, z - y % z) if x % z + y % z >= z else 0
	print(fst, snd)
pars = input().split(' ')
fun(int(pars[0]), int(pars[1]), int(pars[2]))


(a, b, c) = list(map(int, input().split()))
o1 = a % c
o2 = b % c
n = a // c + b // c
p = 0
if o1 + o2 >= c:
	p = min(c - o1, c - o2)
	n += 1
print(n, p)


from collections import defaultdict as dd
import math
import sys
input = sys.stdin.readline

def nn():
	return int(input())

def li():
	return list(input())

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

def lm():
	return list(map(int, input().split()))
(x, y, z) = mi()
t = 0
t += x // z + y // z
x = x % z
y = y % z
if x + y < z:
	print(t, 0)
else:
	print(t + 1, min(z - x, z - y))


(x, y, z) = map(int, input().split())
g = 0
if x % z + y % z >= z:
	g = z - max(x % z, y % z)
print((x + y) // z, g)


(x, y, z) = [int(x) for x in input().split()]
c = 0
n = x // z + y // z
x = x - x // z * z
y = y - y // z * z
if x >= y and x + y >= z:
	print(n + 1, z - x)
elif x < y and x + y >= z:
	print(n + 1, z - y)
else:
	print(n, 0)


(x, y, z) = map(int, input().split())
count = 0
count += x // z
x -= x // z * z
count += y // z
y -= y // z * z
a = max(x, y)
b = min(x, y)
count += (a + b) // z
print(count, max(0, (a + b) // z * z - a))


(a, b, c) = map(int, input().split())
d = a // c
e = b // c
f = a % c
z = b % c
(f, z) = sorted([f, z])
y = f - (f + z) % c if f + z >= c else 0
x = d + e
x += 1 if y else 0
print(x, y)


from sys import *
from math import *
from bisect import *
(x, y, z) = map(int, stdin.readline().split())
print((x + y) // z, end=' ')
k = (x + y) // z
if k == x // z + y // z:
	print(0)
else:
	x1 = z - x % z
	y1 = z - y % z
	print(min(x1, y1))


(a, b, c) = list(map(int, input().split()))
(A, B) = (a % c, b % c)
count = a // c + b // c
SUM = A + B
Ans = 0
if SUM >= c:
	Max = max(A, B)
	Ans = c - Max
	count += 1
print(count, Ans)


(a, b, c) = map(int, input().split())
d = a // c
d += b // c
g = (a + b) // c
print(g, max((g - d) * c - max(a % c, b % c), 0))


(sasha, masha, cost) = map(int, input().split())
mx = (sasha + masha) // cost
chmx = sasha // cost + masha // cost
d = 0
if chmx != mx:
	dsh = sasha % cost
	dmh = masha % cost
	if dsh + dmh >= cost:
		d = min((dsh, dmh)) - (dmh + dsh - cost)
print(mx, d)


import sys
input = sys.stdin.readline
(x, y, z) = list(map(int, input().split()))
modx = x % z
mody = y % z
print((x + y) // z, end=' ')
if modx + mody >= z:
	print(z - max(modx, mody))
else:
	print('0')


(x, y, z) = map(int, input().split(' '))
coco = (x + y) // z
a = x % z
b = y % z
res = 0
if x // z + y // z == coco:
	res = 0
	print(coco, res)
	exit()
if a == 0 and b == 0:
	res = 0
elif z - max(a, b) > min(a, b):
	res = min(a, b)
else:
	res = z - max(a, b)
print(coco, res)


(x, y, z) = map(int, input().split())
print((x + y) // z, end=' ')
a = x % z
b = y % z
if a + b >= z:
	print(z - max(a, b))
else:
	print('0')


(n, m, k) = list(map(int, input().split()))
a = (n + m) // k
if a > n // k + m // k:
	b = min(k - n % k, k - m % k)
else:
	b = 0
print(a, b)


xyz = input().split()
x = int(xyz[0])
y = int(xyz[1])
z = int(xyz[2])
max_coc = (x + y) // z
rem_x = x % z
rem_y = y % z
if rem_x + rem_y < z:
	print(str(max_coc) + ' 0')
elif rem_x >= rem_y:
	print(str(max_coc) + ' ' + str(z - rem_x))
elif rem_y > rem_x:
	print(str(max_coc) + ' ' + str(z - rem_y))


(x, y, z) = map(int, input().split())
minimum = (x + y) % z
maximumCoconut = (x + y) // z
print(maximumCoconut, max(min(x % z - minimum, y % z - minimum), 0))


(x, y, z) = map(int, input().split())
xm = x % z
xy = y % z
print((x + y) // z, end=' ')
print(z - max(xm, xy) if xm + xy >= z else 0)


from sys import stdin, stdout
import math
from itertools import combinations
from copy import deepcopy
import math
(x, y, z) = list(map(int, stdin.readline().split()))
first = x % z
f = x // z
second = y % z
s = y // z
third = (first + second) % z
t = (first + second) // z
if t > 0:
	if third == 0:
		ans = min(first, second)
	elif first > second:
		ans = z - first
	else:
		ans = z - second
else:
	ans = 0
print(f + s + t, ans)


def main():
	s = [int(x) for x in input().split()]
	x = s[0]
	y = s[1]
	z = s[2]
	coconut = x // z + y // z
	money = 0
	masha = x % z
	dasha = y % z
	sum = masha + dasha
	if sum >= z:
		coconut += sum // z
		money += z - max(masha, dasha)
	print(coconut, money)
main()


(x, y, z) = list(map(int, input().split()))
a = z - x % z
b = z - y % z
ans1 = x // z + 1 + (y - a) // z if y - a >= 0 else 0
ans2 = y // z + 1 + (x - b) // z if x - b >= 0 else 0
ans3 = x // z + y // z
m = max(ans1, ans2, ans3)
if ans3 == m:
	print(ans3, 0)
elif ans1 == ans2 == m:
	print(ans1, min(a, b))
elif ans1 == m:
	print(ans1, a)
elif ans2 == m:
	print(ans2, b)


(x, y, z) = map(int, input().split())
l1 = x % z
l2 = y % z
s = l1 + l2
ans = x // z + y // z
if s >= z:
	print(ans + s // z, min(z - l1, z - l2))
else:
	print(ans, 0)


(x, y, z) = map(int, input().split())
coco = (x + y) // z
ans = 0
if x // z + y // z == coco:
	ans = 0
else:
	ans = min(z - x % z, z - y % z)
print(coco, ans)


def fun(x, y, z):
	a = x % z
	b = y % z
	c = x // z
	d = y // z
	e = (max(a, b) + min(a, b)) // z
	to = z * e - max(a, b)
	if to < 0:
		to = 0
	return (e + c + d, to)
x = list(map(int, input().split()))
(a, b) = fun(x[0], x[1], x[2])
print(a, b)


(x, y, z) = list(map(int, input().strip().split()))
print(x // z + y // z + (x % z + y % z) // z, min(z - x % z, z - y % z) * int((x % z + y % z) // z > 0))


(x, y, z) = map(int, input().split())
tot = (x + y) // z
min1 = -1
if x // z + y // z == tot:
	min1 = 0
else:
	min1 = min(z - x % z, z - y % z)
print(tot, min1)


Input = lambda : map(int, input().split())
(x, y, z) = Input()
print((x + y) // z, end=' ')
Coconut = x // z
x %= z
Coconut += y // z
y %= z
r = (x + y) // z
Coconut += r
if r == 0:
	print(0)
else:
	print(min(x, y) - (x + y) % z)


(x, y, z) = map(int, input().split())
sum = x // z + y // z
(x, y) = (x % z, y % z)
t = (x + y) // z
sum += t
s = z - max(x, y)
if t == 0:
	print(sum, t)
else:
	print(sum, s)


(x, y, z) = map(int, input().split())
coconut = 0
coconut += x // z + y // z
residual = x % z + y % z
if residual >= z:
	coconut += 1
	print(f'{coconut} {min(z - x % z, z - y % z)}')
else:
	print(f'{coconut} 0')


(x, y, z) = list(map(int, input().split()))
coco = (x + y) // z
xRemainder = x % z
yRemainder = y % z
xNyRemainder = (x + y) % z
x_diff = xRemainder - xNyRemainder
y_diff = yRemainder - xNyRemainder
minXchange = 0
if x_diff > y_diff:
	minXchange = y_diff
else:
	minXchange = x_diff
if minXchange < 0:
	minXchange = 0
print(coco, minXchange)


(a, b, c) = map(int, input().split())
if a % c + b % c >= c:
	print(a // c + b // c + 1, c - max(a % c, b % c))
else:
	print(a // c + b // c, 0)


def find(a, b, cost):
	x = a % cost
	y = b % cost
	c = cost - x
	d = cost - y
	if x == cost or y == cost:
		return [a // cost + b // cost, 0]
	elif c < d:
		if c <= y:
			transfer = c
			return [a // cost + 1 + b // cost, transfer]
		else:
			transfer = 0
			return [a // cost + b // cost, transfer]
	elif d <= x:
		transfer = d
		return [a // cost + b // cost + 1, transfer]
	else:
		transfer = 0
		return [a // cost + b // cost, transfer]
m = list(map(int, input().strip().split()))
print(' '.join((str(x) for x in find(m[0], m[1], m[2]))))


(g1, g2, c) = [int(i) for i in input().strip().split()]
out = 0 if g1 % c + g2 % c < c else min((c - g1 % c) % c, (c - g2 % c) % c)
print((g1 + g2) // c, out)


(x, y, z) = map(int, input().split(' '))
x1 = x % z
x2 = y % z
if x1 + x2 >= z:
	print((x + y) // z, z - max(x1, x2))
else:
	print((x + y) // z, 0)


(x, y, z) = map(int, input().strip().split(' '))
if (x + y) // z > x // z + y // z:
	w = min(z - x % z, z - y % z)
	w1 = (x + y) // z
	print(w1, w, end=' ')
else:
	w = x // z + y // z
	print(w, 0, end=' ')


from math import *
from itertools import *
from collections import *
from bisect import *
(x, y, c) = map(int, input().split())
a = x // c
x %= c
b = y // c
y %= c
t = a + b
if x + y >= c:
	if x > y:
		g = c - x
	else:
		g = c - y
	t += 1
else:
	g = 0
print(t, g)


(x, y, z) = input().split()
x = int(x)
y = int(y)
z = int(z)
ans = 0
exchange = 0
if x % z == 0 or y % z == 0:
	ans = (x + y) // z
	exchange = 0
elif x % z != 0 and y % z != 0:
	ans = (x + y) // z
	temp = z - max(x % z, y % z)
	if min(x % z, y % z) >= temp:
		exchange = temp
print(ans, exchange)


(x, y, z) = (int(x) for x in input().split())
coconut = x // z + y // z
sasha_rem = x % z
masha_rem = y % z
if sasha_rem + masha_rem >= z:
	debt = z - max(sasha_rem, masha_rem)
	print(coconut + 1, debt)
else:
	print(coconut, 0)


x = list(map(int, input().split(' ')))
if (x[0] + x[1]) // x[2] != x[0] // x[2] + x[1] // x[2]:
	print((x[0] + x[1]) // x[2], x[2] - max(x[0] % x[2], x[1] % x[2]))
else:
	print((x[0] + x[1]) // x[2], 0)


(x, y, z) = map(int, input().split())
coco = 0
debt = 0
coco += x // z + y // z
x %= z
y %= z
if x + y >= z:
	coco += 1
	debt += min(z - x, z - y)
print(coco, debt)


(x, y, z) = map(int, input().split())
p = []
p.append(str((x + y) // z))
a = x % z
b = y % z
if b > a:
	(a, b) = (b, a)
if z - a <= b:
	p.append(str(z - a))
else:
	p.append(str(0))
print(' '.join(p))


(a, b, c) = map(int, input().split())
x = a // c + b // c
a %= c
b %= c
z = 0
if a + b >= c:
	z = min(a, b) - (a + b - c)
	x += 1
print(x, z)


(x, y, z) = [int(x) for x in input().split()]
modx = x % z
mody = y % z
transfer = 0
if modx + mody >= z:
	transfer = z - max(modx, mody)
	if modx > mody:
		x += transfer
		y -= transfer
	else:
		y += transfer
		x -= transfer
print(x // z + y // z, transfer)


n = list(input().split())
n = [int(x) for x in n]
a = n[0] // n[2]
a2 = n[0] % n[2]
b = n[1] // n[2]
b2 = n[1] % n[2]
coco = a + b
x = 0
if (a2 + b2) // n[2] > 0:
	x = n[2] - max(a2, b2)
	coco += 1
print(coco, x)


m = input().split()
(x, y, z) = (int(m[0]), int(m[1]), int(m[2]))
a = x % z
b = y % z
c = (x + y) // z
if a == 0 or b == 0:
	print('{} 0'.format(c))
elif a > b:
	if a + b < z:
		print('{} {}'.format(c, 0))
	else:
		print('{} {}'.format(c, min(b, z - a)))
elif a + b < z:
	print('{} {}'.format(c, 0))
else:
	print('{} {}'.format(c, min(a, z - b)))


while True:
	try:
		(x, y, z) = map(int, input().strip().split())
		print((x + y) // z, end=' ')
		if x // z + y // z == (x + y) // z:
			print(0)
		else:
			print(min(z - x % z, z - y % z))
	except EOFError:
		break


(x, y, z) = map(int, input().split())
ostx = x % z
osty = y % z
if ostx + osty >= z:
	if ostx > osty:
		count = z - ostx
	else:
		count = z - osty
	print(x // z + y // z + 1, count)
else:
	print(x // z + y // z, 0)


(x, y, z) = map(int, input().split())
coconuts = (x + y) // z
mod1 = x % z
mod2 = y % z
mod3 = (x + y) % z
if coconuts == x // z + y // z:
	print(coconuts, 0)
else:
	exchange = int(min(abs(mod3 - mod2), abs(mod3 - mod1)))
	print(coconuts, exchange)


(x, y, z) = map(int, input().split())
if x % z == 0 or y % z == 0:
	print(x // z + y // z, 0)
else:
	num1 = x % z
	num2 = y % z
	if (x + num2) // z <= x // z and (y + num1) // z <= y // z:
		print(x // z + y // z, 0)
	else:
		num1 = z - num1
		num2 = z - num2
		if num1 > num2:
			print(x // z + y // z + 1, num2)
		else:
			print(x // z + y // z + 1, num1)


(a, b, z) = list(map(int, input().split()))
q1 = a // z + b // z
q2 = (a + b) // z
if q1 == q2:
	print(q1, 0)
else:
	print(max(q1, q2), z - max(a % z, b % z))


s = input()
(a, b, c) = s.split()
a = int(a)
b = int(b)
c = int(c)
if a % c + b % c == c:
	print((a + b) // c, min(a % c, b % c))
if a % c + b % c < c:
	print((a + b) // c, 0)
if a % c + b % c > c:
	print((a + b) // c, min(c - a % c, c - b % c))


(x, y, z) = map(int, input().split())
x_count = x // z
x_mod = x % z
y_count = y // z
y_mod = y % z
count = x_count + y_count
if y_mod + x_mod >= z:
	count += 1
	change = z - max(y_mod, x_mod)
	print(count, change)
else:
	print(count, 0)


(x, y, z) = map(int, input().split())
temp = (x + y) // z
a = z - x % z
b = z - y % z
if temp == x // z + y // z:
	print('{} 0'.format(temp))
else:
	temp2 = min(a, b)
	print('{} {}'.format(temp, temp2))


(n, m, z) = list(map(int, input().split()))
print(n // z + m // z + (n % z + m % z) // z, end=' ')
cnt = (n % z + m % z) // z * z
cnt = max(0, cnt - max(n % z, m % z))
print(cnt)


a = input()
b = a.split()
c = [int(d) for d in b]
n = []
r0 = c[0] % c[2]
r1 = c[1] % c[2]
q0 = c[0] // c[2]
q1 = c[1] // c[2]
q2 = (r0 + r1) // c[2]
m = min(c[2] - r0, c[2] - r1)
if q2 == 0:
	n.append(0)
else:
	n.append(m)
d = q0 + q1 + q2
print(d, n[0])


(a, b, c) = map(int, input().split())
tot = (a + b) // c
d = a % c
e = b % c
k = 0
if d + e >= c:
	k = c - max(d, e)
print(tot, end=' ')
print(k)


(sasha, masha, price) = map(int, input().split())
total = (sasha + masha) // price
remSasha = sasha % price
remMasha = masha % price
together = (remSasha + remMasha) // price * price
give = min(together - remSasha, together - remMasha)
print(total, max(give, 0))


a = list(map(int, input().split()))
b = int((a[0] + a[1]) // a[2])
x = a[0] % a[2]
y = a[1] % a[2]
if x + y == a[2]:
	print(b, min(x, y))
elif x + y > a[2]:
	print(b, a[2] - max(x, y))
else:
	print(b, 0)


(x, y, z) = map(int, input().split())
a = str((x + y) // z)
n = x // z
t = y // z
if x % z == 0 or y % z == 0:
	b = '0'
else:
	l = min(x, y)
	n = l // z
	n += 1
	m = n * z - l
	n -= 1
	d = l - n * z
	if m < d:
		j = max(x, y)
		j -= m
		l += m
		if x // z + y // z >= j // z + l // z:
			print(a + ' 0')
			exit()
		else:
			b11 = m
	else:
		j = max(x, y)
		j += d
		l -= d
		if x // z + y // z >= j // z + l // z:
			print(a + ' 0')
			exit()
			b = '0'
		else:
			b11 = d
	q = max(x, y)
	n = q // z
	n += 1
	m = n * z - q
	n -= 1
	d = q - n * z
	if m < d:
		j = min(x, y)
		j -= m
		q += m
		b22 = m
	else:
		j = min(x, y)
		j += d
		q -= d
		b22 = d
	b = str(min(b11, b22))
print(a + ' ' + b)


(x, y, z) = input().split()
x = int(x)
y = int(y)
z = int(z)
max_coco = 0
min_coins = 0
first = x % z
second = y % z
if first + second >= z:
	max_coco = x // z + y // z + (first + second) // z
	min_coins = min(first, second) - (first + second) % z
else:
	max_coco = x // z + y // z
	min_coins = 0
print(max_coco, min_coins)


(m, n, c) = map(int, input().split())
arr = []
arr.append(int((m + n) // c))
r1 = m % c
r2 = n % c
count = 0
low = min(r1, r2)
if low == r1:
	if c - r2 <= r1:
		count = c - r2
if low == r2:
	if c - r1 <= r2:
		count = c - r1
arr.append(count)
for ele in arr:
	print(ele, end=' ')


(x, y, z) = map(int, input().split())
cocs = (x + y) // z
if x // z + y // z == cocs:
	giv = 0
else:
	p1 = cocs - y // z
	p2 = y // z
	p3 = x // z
	p4 = cocs - x // z
	c1 = abs(p1 * z - x) + abs(p2 * z - y)
	c2 = abs(p3 * z - x) + abs(p4 * z - y)
	if c1 <= c2:
		giv = min(abs(p1 * z - x), abs(p2 * z - y))
	else:
		giv = min(abs(p3 * z - x), abs(p4 * z - y))
ans = [cocs, giv]
print(*ans)


(n, m, p) = map(int, input().split())
if n % p == 0 and m % p == 0:
	print(n // p + m // p, 0)
	exit()
else:
	x1 = n % p
	x2 = m % p
	x3 = min(x1, x2)
	x4 = max(x1, x2)
	if x1 + x2 >= p and x3 >= p - x4:
		print(n // p + m // p + (x1 + x2) // p, p - x4)
	else:
		print(n // p + m // p, 0)


r = [int(x) for x in input().split()]
m = r[0]
n = r[1]
z = r[2]
maxNum = (m + n) // z
if m // z + n // z == (m + n) // z:
	minSwitch = 0
else:
	minSwitch = z - max(m % z, n % z)
print(maxNum, end=' ')
print(minSwitch)


n = input()
a = [int(i) for i in n.split()]
p1 = a[0] % a[2]
p2 = a[1] % a[2]
ans2 = a[2] - max(p1, p2)
if p1 == 0 or p2 == 0 or p1 + p2 < a[2]:
	ans2 = 0
ans1 = (a[0] + a[1]) // a[2]
print('%d %d' % (ans1, ans2))


(x, y, z) = map(int, input().split())
m = 0
if x % z + y % z >= z:
	m = max(x % z, y % z)
	m = z - m
print((x + y) // z, m)


import sys
a = list(map(int, input().split()))
(x, y, z) = (a[0], a[1], a[2])
total = x // z + y // z
if x % z == 0 and y % z == 0:
	print(total, 0)
else:
	left = x % z + y % z
	if left % z == 0:
		print(total + left // z, min(x % z, y % z))
	elif left % z != 0 and left > z:
		a = min(z - x % z, z - y % z)
		print(total + left // z, a)
	else:
		print(total, 0)


l = input()
list = l.split()
x = int(list[0])
y = int(list[1])
cost = int(list[2])
if x % cost + y % cost >= cost:
	print(int((x + y) // cost), cost - max(x % cost, y % cost))
else:
	print(int((x + y) // cost), 0)


(x, y, c) = map(int, input().strip().split())
x1 = x % c
y1 = y % c
a = 0
if (x1 + y1) // c == 1:
	a = (x1 + y1) // c * c - max(x1, y1)
print((x + y) // c, a)


(x, y, z) = map(int, input().split())
ans = x // z + y // z
an2 = 0
if x % z + y % z >= z:
	ans += 1
	an2 = min(z - y % z, z - x % z)
print(str(ans) + ' ' + str(an2))


(x, y, z) = map(int, input().split())
ans = x // z + y // z
left1 = x % z
left2 = y % z
temp = (left1 + left2) // z
ans += temp
ans2 = temp * z - max(left1, left2)
if ans2 < 0:
	ans2 = 0
print(ans, ans2)


(x, y, z) = map(int, input().split())
total = (x + y) // z
x = x % z
y = y % z
n = (x + y) // z
if x and y and n:
	print(total, (z - max(x, y)) % z)
else:
	print(total, 0)


def main():
	(x, y, z) = map(int, input().split())
	total = x // z + y // z
	give = 0
	x %= z
	y %= z
	if x + y >= z:
		give += min(z - x, z - y)
		total += 1
	print(total, give)
main()


data_input = input().split()
sasha = int(data_input[0])
masha = int(data_input[1])
chijik = int(data_input[2])
answer1 = sasha // chijik + masha // chijik
sasha = sasha % chijik
masha = masha % chijik
if sasha > masha:
	sasha += masha
	if sasha // chijik > 0:
		answer1 += sasha // chijik
		answer2 = masha - sasha % chijik
	else:
		answer2 = 0
else:
	masha += sasha
	if masha // chijik > 0:
		answer1 += masha // chijik
		answer2 = sasha - masha % chijik
	else:
		answer2 = 0
print(answer1, answer2)


(x, y, z) = map(int, input().split())
t1 = x // z
t2 = y // z
x = x % z
y = y % z
(x, y) = (max(x, y), min(x, y))
if x + y >= z:
	print(t1 + t2 + 1, z - x)
else:
	print(t1 + t2, 0)


(x, y, z) = map(int, input().split())
(c1, c2) = (x // z, y // z)
(r1, r2) = (x - c1 * z, y - c2 * z)
if r1 == 0 or r2 == 0:
	print(c1 + c2, 0)
else:
	(req1, req2) = (z - r1, z - r2)
	if r2 >= req1 and req1 + r1 >= z or (r1 >= req2 and req2 + r2 >= z):
		print(c1 + c2 + 1, min(req1, req2))
	else:
		print(c1 + c2, 0)


(x, y, z) = map(int, input().split())
a = x % z
b = y % z
p = x // z + y // z
req1 = z - a
req2 = z - b
if b >= req1 and a >= req2:
	print(p + 1, min(req1, req2))
elif b >= req1:
	print(p + 1, req1)
elif a >= req2:
	print(p + 1, req2)
else:
	print(p, 0)


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

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

def li():
	return list(mi())

def si():
	return input()
(x, y, z) = mi()
s = (x + y) // z
x1 = x % z
y1 = y % z
x2 = z - x1
y2 = z - y1
if x2 <= y1:
	x = x2
else:
	x = 0
if y2 <= x1:
	y = y2
else:
	y = 0
print(s, min(x, y))


xyz = [int(x) for x in input().split()]
x = xyz[0]
y = xyz[1]
z = xyz[2]
print((x + y) // z, end=' ')
if x // z + y // z == (x + y) // z:
	print(0)
else:
	xr = x % z
	yr = y % z
	Max = xr if xr > yr else yr
	print(z - Max)


inp = list(map(int, input().split()))
x = inp[0]
y = inp[1]
z = inp[2]
a = x % z
b = y % z
if a + b < z:
	print((x + y) // z, end=' ')
	print(0)
else:
	print((x + y) // z, end=' ')
	print(min((x // z + 1) * z - x, (y // z + 1) * z - y))


(x, y, z) = map(int, input().split())
d1 = x // z
d2 = y // z
ost1 = x - z * d1
ost2 = y - z * d2
if ost1 + ost2 >= z:
	print((x + y) // z, min(z - ost1, z - ost2))
else:
	print((x + y) // z, 0)


(x, y, z) = map(int, input().split())
ax = x % z
ay = y % z
aax = x // z
aay = y // z
if z - ax < z - ay:
	if z - ax <= ay:
		print(aax + aay + 1, z - ax)
	else:
		print(aax + aay, 0)
elif z - ay <= ax:
	print(aax + aay + 1, z - ay)
else:
	print(aax + aay, 0)


(person1, person2, price) = input().split(' ')
(person1, person2, price) = (int(person1), int(person2), int(price))
tmp1 = person1 % price
tmp2 = person2 % price
if tmp2 + tmp1 < price:
	print(person1 // price + person2 // price, 0)
else:
	print(person1 // price + person2 // price + 1, price - max(tmp1, tmp2))


lst = [int(x) for x in input().split()]
num_coco = (lst[0] + lst[1]) // lst[2]
a = lst[0] % lst[2]
b = lst[1] % lst[2]
c = lst[2] - a
d = lst[2] - b
arr = [a, b, c, d]
arr.sort()
if a + b < lst[2]:
	print(num_coco, 0)
else:
	print(num_coco, arr[0])


(x, y, z) = map(int, input().split())
if x % z == 0 and y % z == 0:
	print((x + y) // z, 0)
elif x % z == 0 and y % z != 0 or (y % z == 0 and x % z != 0):
	print((x + y) // z, 0)
else:
	mina = z - x % z
	minb = z - y % z
	if mina < minb:
		if y % z >= mina:
			print((x + y) // z, mina)
		else:
			print((x + y) // z, 0)
	elif x % z >= minb:
		print((x + y) // z, minb)
	else:
		print((x + y) // z, 0)


n = [int(i) for i in input().split()]
x1 = n[0] // n[2] + n[1] // n[2]
x = (n[0] + n[1]) // n[2]
e = 0
if min(n[0] % n[2], n[1] % n[2]) != 0:
	e = min(n[2] - n[0] % n[2], n[2] - n[1] % n[2])
if x > x1:
	print(x, e)
else:
	print(x1, 0)


(x, y, z) = [int(x) for x in input().split(' ')]
x1 = x // z
y1 = y // z
z1 = (x + y) // z
if x1 + y1 == z1:
	print(z1, 0)
else:
	print(z1, min(x % z, y % z, z - x % z, z - y % z))


import sys

def rl(proc=None):
	if proc is not None:
		return proc(sys.stdin.readline())
	else:
		return sys.stdin.readline().rstrip()

def srl(proc=None):
	if proc is not None:
		return list(map(proc, rl().split()))
	else:
		return rl().split()

def main():
	(x, y, z) = srl(int)
	tot = x // z + y // z
	x %= z
	y %= z
	b = 0
	if x + y >= z:
		tot += 1
		b = min(z - x, z - y)
	print(tot, b)
main()


(x, y, n) = map(int, input().split())
a = x // n + y // n
b = (x + y) // n
if a == b:
	print(a, 0)
else:
	m1 = x % n
	m2 = y % n
	print(b, end=' ')
	if n - m1 < n - m2:
		print(n - m1)
	else:
		print(n - m2)


(x, y, z) = list(map(int, input().split()))
rem_x = x % z
ans_x = x // z
rem_y = y % z
ans_y = y // z
trans = 0
ans = ans_x + ans_y
if rem_x != 0 and rem_y != 0 and (rem_x + rem_y >= z):
	trans = min(z - rem_x, z - rem_y)
	ans += 1
print(ans, trans)


(x, y, z) = map(int, input().strip().split(' '))
rz = (x + y) % z
print((x + y) // z, max(min(x % z - rz, y % z - rz), 0))


(x, y, z) = map(int, input().split())
ans = (x + y) // z
a = x // z
b = y // z
c = x - z * a
d = y - z * b
aa = 0
if c + d >= z:
	aa = z - max(c, d)
print(ans, aa)


(x, y, z) = map(int, input().split())
ans = x // z + y // z
(xR, yR) = map(lambda x: x % z, [x, y])
if xR + yR >= z:
	ans += 1
	ans2 = z - max(xR, yR)
else:
	ans2 = 0
print(ans, ans2)


(N, S, K) = map(int, input().split())
ans = (N + S) // K
O = N % K
R = S % K
count = 0
if O + R >= K:
	count = K - max(O, R)
print(ans, count)


(x, y, z) = map(int, input().split())
c = x // z
p = x % z
c += y // z
q = y % z
if p + q < z:
	print('{} 0'.format(c))
else:
	print('{} {}'.format(c + 1, min(z - p, z - q)))


(x, y, z) = [int(s) for s in input().split()]
if x % z == 0 and y % z == 0:
	ans = 0
elif x % z == 0 and y % z != 0:
	ans = 0
elif x % z != 0 and y % z == 0:
	ans = 0
elif x % z + y % z < z:
	ans = 0
else:
	ans = min(z - x % z, z - y % z)
print((x + y) // z, ans)


(a, b, c) = [int(i) for i in input().split()]
d = (a + b) // c
e = a % c
f = b % c
if e > 0 and f > 0 and (e + f >= c):
	print(d, min(c - e, c - f))
else:
	print(d, 0)


(x, y, z) = map(int, input().split())
(a, b) = (x // z, y // z)
(c, d) = (x % z, y % z)
n = (x + y) // z
if n == a + b:
	m = 0
else:
	m = min((a + 1) * z - x, (b + 1) * z - y)
print(n, m)


(s, m, cost) = list(map(int, input().split()))
cnt = s // cost + m // cost
ost_s = s % cost
ost_m = m % cost
if ost_s + ost_m >= cost:
	print(cnt + 1, min(cost - ost_s, cost - ost_m))
else:
	print(cnt, 0)


import sys, math

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

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

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

def read_string_list(delim=' '):
	return sys.stdin.readline().strip().split(delim)

def print_list(l):
	print(' '.join(map(str, l)))
(x, y, z) = read_int_list()
if x // z + y // z == (x + y) // z:
	print((x + y) // z, 0)
else:
	print((x + y) // z, min(x % z, y % z, z - x % z, z - y % z))


(x, y, z) = map(int, input().split(' '))
a = x // z
b = y // z
c = (x + y) // z
if a + b == c:
	print(c, 0)
else:
	aa = x % z
	bb = y % z
	zz = min(aa, bb, z - aa, z - bb)
	print(c, zz)


(x, y, z) = [int(i) for i in input().split()]
div = (x + y) // z
if x % z == 0 or y % z == 0:
	to_give = 0
elif x // z + y // z < div:
	to_give = min(z - y % z, z - x % z)
else:
	to_give = 0
print(div, to_give)


(x, y, z) = map(int, input().split())
k1 = x // z
k2 = x - k1 * z
n1 = y // z
n2 = y - n1 * z
if k2 + n2 < z:
	print(k1 + n1, 0)
else:
	print(k1 + n1 + 1, z - max(k2, n2))


(x, y, z) = map(int, input().split())
if x % z == 0 and y % z == 0:
	print(x // z + y // z, 0)
else:
	r1 = x % z
	r2 = y % z
	ans = 0
	if r1 > r2:
		if z - r1 <= r2:
			x += z - r1
			ans = z - r1
		else:
			ans = 0
	elif z - r2 <= r1:
		y += z - r2
		ans = z - r2
	else:
		ans = 0
	print(x // z + y // z, ans)


(x, y, z) = map(int, input().split())
x1 = x % z
y1 = y % z
s = x // z + y // z
if x1 + y1 < z:
	print(s, 0)
else:
	print(s + 1, min(z - x1, z - y1))


(x, y, z) = list(map(int, input().split()))
s = x % z
m = y % z
res = [(x + y) // z]
if s + m >= z:
	res.append(min(s, m) - (s + m) % z)
else:
	res.append(0)
print(*res)


(x, y, z) = map(int, input().split())
if x % z == 0 or y % z == 0:
	print((x + y) // z, 0)
else:
	s = x // z
	t = y // z
	v = (x + y) // z
	if s + t == v:
		print(v, 0)
	else:
		a = s * z + z - x
		b = t * z + z - y
		c = min(a, b)
		print(v, c)


(x, y, z) = map(int, input().split())
without = x // z + y // z
max_count = (x + y) // z
if without == max_count:
	print(without, 0)
else:
	x1 = x % z
	y1 = y % z
	print(max_count, min(abs(z - x1), abs(z - y1)))


(x, y, price) = map(int, input().split())
max_buy = (x + y) // price
x = x % price
y = y % price
min_cost = min(price - x, price - y) if x + y >= price else 0
print(max_buy, min_cost)


(x, y, z) = map(int, input().split())
if x % z == 0 or y % z == 0:
	print((x + y) // z, 0)
elif x % z < y % z:
	if x % z < z - y % z:
		print((x + y) // z, 0)
	else:
		print((x + y) // z, z - y % z)
elif y % z < z - x % z:
	print((x + y) // z, 0)
else:
	print((x + y) // z, z - x % z)


import sys, math, queue, bisect
MOD = 10 ** 9 + 7
sys.setrecursionlimit(1000000)
(x, y, z) = map(int, input().split())
mx = (x + y) // z
r1 = x % z
r2 = y % z
if r1 + r2 >= z:
	print(mx, min(z - r1, z - r2))
else:
	print(mx, 0)


(x, y, z) = [int(i) for i in input().split(' ')]
mx = x % z
my = y % z
e = 0
c = x // z + y // z
if mx + my >= z:
	e = z - max(mx, my)
	c += 1
print(c, e, sep=' ')


(a, b, c) = map(int, input().split())
ans1 = a // c + b // c
ans2 = (a + b) // c
if ans1 == ans2:
	print(str(ans1) + ' 0')
else:
	print(str(ans2) + ' ' + str(c - max(a % c, b % c)))


(x, y, z) = map(int, input().split())
r1 = (x + y) // z
r2 = (x + y) % z
print(r1, max(min(x % z - r2, y % z - r2), 0))


(x, y, z) = [int(x) for x in input().split()]
mod1 = x % z
mod2 = y % z
final_mod = 0
if mod1 + mod2 >= z:
	if mod1 < mod2:
		x -= z - mod2
		y += z - mod2
		final_mod = z - mod2
	else:
		y -= z - mod1
		x += z - mod1
		final_mod = z - mod1
print(x // z + y // z, final_mod)


def compute(x, y, z):
	val = x // z + y // z
	val2 = (x + y) // z
	if val2 > val:
		return (val2, min(z - x % z, z - y % z))
	return (val, 0)

def main():
	(x, y, z) = input().split(' ')
	x = int(x)
	y = int(y)
	z = int(z)
	(coc, tr) = compute(x, y, z)
	print(str(coc) + ' ' + str(tr))
main()


(sasha, masha, cost) = [int(x) for x in input().split()]
coconuts = sasha // cost + masha // cost
(sasha_left, masha_left) = (sasha % cost, masha % cost)
if sasha_left == 0 and masha_left == 0:
	print(coconuts, 0)
elif sasha_left + masha_left >= cost:
	shasa_need = cost - sasha_left
	masha_need = cost - masha_left
	print(coconuts + 1, min(shasa_need, masha_need))
else:
	print(coconuts, 0)


import sys

def fastio():
	from io import StringIO
	from atexit import register
	global input
	sys.stdin = StringIO(sys.stdin.read())
	input = lambda : sys.stdin.readline().rstrip('\r\n')
	sys.stdout = StringIO()
	register(lambda : sys.__stdout__.write(sys.stdout.getvalue()))
fastio()

def debug(*var, sep=' ', end='\n'):
	print(*var, file=sys.stderr, end=end, sep=sep)
INF = 10 ** 20
MOD = 10 ** 9 + 7
I = lambda : list(map(int, input().split()))
from math import gcd
from math import ceil
from collections import defaultdict as dd, Counter
from bisect import bisect_left as bl, bisect_right as br
(x, y, z) = I()
ans = z - x % z
ok = z - y % z
if ans > ok:
	ans = ok
if x // z + y // z == (x + y) // z:
	ans = 0
print((x + y) // z, ans)


(a, b, c) = map(int, input().split())
m = (a + b) // c
r = (a + b) % c
mi = min(a % c - r, b % c - r)
print(m, max(mi, 0))


import math
from bisect import bisect_left, bisect_right
from sys import stdin, stdout
input = lambda : stdin.readline().strip()
print = lambda s: stdout.write(s)
(x, y, z) = map(int, input().split())
if (x + y) // z > x // z + y // z:
	print(str((x + y) // z) + ' ' + str(min((z - x) % z, (z - y) % z)) + '\n')
else:
	print(str((x + y) // z) + ' 0\n')


vstup = list(map(int, input().split()))
caja1 = vstup[0]
caja2 = vstup[1]
cena = vstup[2]
doplatok = 0
zostatokcaja1 = caja1 % cena
zostatokcaja2 = caja2 % cena
if zostatokcaja1 + zostatokcaja2 >= cena:
	doplatok = cena - max([zostatokcaja2, zostatokcaja1])
print(int((caja1 + caja2) // cena), doplatok)


import sys, collections
(a, b, c) = map(int, sys.stdin.readline().split())
if a == 0 or b == 0:
	print((a + b) // c, 0)
elif (a + b) // c == 0:
	print(0, 0)
else:
	temp = []
	temp.append((a // c + b // c, 0))
	diff1 = max(a, b) // c if max(a, b) % c == 0 else max(a, b) // c + 1
	ans1 = diff1 * c - max(a, b)
	if min(a, b) >= ans1:
		temp.append(((a + b) // c, ans1))
	diff2 = min(a, b) // c if min(a, b) % c == 0 else min(a, b) // c + 1
	ans2 = diff2 * c - min(a, b)
	if max(a, b) >= ans2:
		temp.append(((a + b) // c, ans2))
	temp.sort(key=lambda x: (-x[0], x[1]))
	print(temp[0][0], temp[0][1])


(x, y, z) = map(int, input().split())
x_cocu = x // z
x_left = x % z
y_cocu = y // z
y_left = y % z
total_cocu = x_cocu + y_cocu
re = 0
if x_left + y_left >= z:
	total_cocu += (x_left + y_left) // z
	xy_left = (x_left + y_left) % z
	if x_left > y_left:
		re = y_left - xy_left
	else:
		re = x_left - xy_left
ans = [str(total_cocu), str(re)]
print(' '.join(ans))


def main():
	(a, b, price) = map(int, input().strip().split())
	if a // price + b // price == (a + b) // price:
		print((a + b) // price, 0)
	else:
		if a % price < b % price:
			(a, b) = (b, a)
		res = (a + b) // price
		b = (a // price + 1) * price - a
		print(res, b)
main()


import math
(x, y, z) = [int(x) for x in input().split()]
counter1 = counter2 = math.inf
if (z - x % z) % z <= y % z:
	counter1 = (z - x % z) % z
if (z - y % z) % z <= x % z:
	counter2 = (z - y % z) % z
if counter1 < counter2:
	print((x + y) // z, counter1)
elif counter1 < math.inf:
	print((x + y) // z, counter2)
else:
	print((x + y) // z, 0)


n = input().split()
for i in range(0, len(n)):
	n[i] = int(n[i])
a = (n[0] + n[1]) // n[2]
t1 = n[0] % n[2]
t2 = n[1] % n[2]
if t1 + t2 >= n[2]:
	t = min(abs(n[2] - t1), abs(n[2] - t2))
else:
	t = 0
print(a, t)


(x, y, z) = map(int, input().split())
f = (x + y) // z
if x % z == 0 or y % z == 0:
	print(f, 0)
else:
	f1 = x // z + y // z
	k = z - max(x % z, y % z)
	a1 = (x + k) // z + (y - k) // z
	a2 = (x - k) // z + (y + k) // z
	if a1 > f1 or a2 > f1:
		print(max(a1, a2), k)
	else:
		print(f1, 0)


(x, y, z) = map(int, input().split())
total = x // z + y // z
exchange = 0
if x % z + y % z >= z:
	exchange = z - max(x % z, y % z)
	total += 1
print(total, exchange)


[x, y, z] = list(map(int, input().split()))
tot = x + y
ans = tot // z
print(ans, end=' ')
t1 = x // z
t2 = y // z
if t1 + t2 == ans:
	print(0)
else:
	r1 = x % z
	r2 = y % z
	print(min(z - r1, z - r2))


(x, y, z) = map(int, input().split())
(a, b) = (x % z, y % z)
print(x // z + y // z + 1 if a + b >= z else x // z + y // z, end=' ')
print(min(abs(a - z), abs(b - z)) if a + b >= z else 0)


(x, y, price) = map(int, input().split())
x_ost = x % price
y_ost = y % price
if x_ost + y_ost < price:
	print('{} 0'.format(x // price + y // price))
else:
	print('{} {}'.format(x // price + y // price + 1, price - max(x_ost, y_ost)))


(x, y, z) = [int(x) for x in input().split()]
ans = x // z + y // z
m1 = x % z
m2 = y % z
if m1 != 0 and m2 != 0:
	if m1 + m2 >= z:
		ans += (m1 + m2) // z
		print(ans, min(m1, m2) - (m1 + m2) % z)
	else:
		print(ans, 0)
else:
	print(ans, 0)


(x, y, z) = [int(i) for i in input().split()]
m = (x + y) // z
a = x // z
b = y // z
c = x - z * a
d = y - z * b
mn = 0
if (c + d) // z == 1:
	if c == d and c > 0:
		mn = abs(z - c)
	else:
		r = max(c, d)
		mn = abs(z - r)
print(m, mn)


(x, y, z) = map(int, input().split())
c = 0
a = x // z
b = y // z
n = abs(x - a * z)
m = abs(y - b * z)
if x // z + y // z == (x + y) // z:
	print((x + y) // z, 0)
else:
	if abs(z - n) >= abs(z - m):
		print((x + y) // z, abs(z - m))
	if abs(z - n) < abs(z - m):
		print((x + y) // z, abs(z - n))


def solve(x, y, z):
	res2 = 0
	res2 = max(0, min(x % z - (x + y) % z, y % z - (x + y) % z))
	return res2

def main():
	(x, y, z) = map(int, input().split())
	print((x + y) // z, solve(x, y, z))
main()


(x, y, z) = input().split()
x = int(x)
y = int(y)
z = int(z)
numco = int((x + y) // z)
if x > y:
	mo = x
	mi = y
else:
	mo = y
	mi = x
mon = (numco - (mo // z + mi // z)) * z - max(mo % z, mi % z)
if mon <= 0:
	mon = 0
print(numco, mon)


(x, y, z) = [int(p) for p in input().split()]
t = (x + y) // z
s = x // z
m = y // z
sr = x - s * z
mr = y - m * z
if s + m != t:
	print(t, min(z - sr, z - mr))
else:
	print(t, 0)


a = [int(i) for i in input().split()]
x = a[0]
y = a[1]
z = a[2]
girl1 = x // z
girl2 = y // z
girl1remain = x % z
girl2remain = y % z
if girl1remain == 0 or girl2remain == 0:
	print(girl1 + girl2, 0)
else:
	totalpossible = (x + y) // z
	totalremain = (x + y) % z
	if totalpossible == girl1 + girl2:
		print(totalpossible, 0)
	else:
		a = totalpossible - girl1 - girl2
		required = a * z
		if -girl1remain + required > -girl2remain + required:
			print(totalpossible, -girl2remain + required)
		else:
			print(totalpossible, -girl1remain + required)


(x, y, z) = map(int, input().split())
if not x % z and (not y % z):
	print(x // z + y // z, 0)
else:
	ost1 = x % z
	ost2 = y % z
	count = float('inf')
	if ost1 >= z - ost2:
		count = z - ost2
	if ost2 >= z - ost1:
		if z - ost1 < count:
			count = z - ost1
	if count == z - ost2:
		x -= count
		y += count
	elif count == z - ost1:
		x += count
		y -= count
	print(x // z + y // z, 0 if count == float('inf') else count)


(x, y, z) = [int(x) for x in input().split()]
c = [x, y]
mods = [p % z for p in c]
if 0 in mods:
	print(x // z + y // z, 0)
else:
	m = max(mods)
	a = c.pop(mods.index(m))
	b = c[0]
	if z - m <= b % z:
		print(a // z + 1 + (b - (z - m)) // z, z - m)
	else:
		print(x // z + y // z, 0)


(x, y, z) = map(int, input().split())
rest_x = x % z
rest_y = y % z
if (rest_x + rest_y) // z == 0:
	print(x // z + y // z, 0)
elif rest_x < rest_y:
	print(1 + x // z + y // z, z - rest_y)
else:
	print(1 + x // z + y // z, z - rest_x)


(x, y, z) = [int(x) for x in input().split()]
maxc = (x + y) // z
if x % z == 0 or y % z == 0:
	minc = 0
else:
	minc = z - max(x % z, y % z)
	if minc > min(x % z, y % z):
		minc = 0
		maxc = x // z + y // z
print(maxc, minc)


(x, y, z) = map(int, input().split(' '))
ans = (x + y) // z
div = (x + y) % z
print(ans, max(min(x % z - div, y % z - div), 0))


(x, y, z) = map(int, input().split())
c = x % z
d = y % z
if c == 0 or d == 0:
	print(x // z + y // z, end=' ')
	print('0')
elif c > d:
	if c + d >= z:
		print(x // z + y // z + 1, end=' ')
		print(z - c)
	else:
		print(x // z + y // z, end=' ')
		print('0')
elif c + d >= z:
	print(x // z + y // z + 1, end=' ')
	print(z - d)
else:
	print(x // z + y // z, end=' ')
	print('0')


(x, y, z) = map(int, input().split())
r_x = x % z
r_y = y % z
c_x = x // z
c_y = y // z
ans1 = 0
ans2 = 0
if r_x + r_y >= z:
	ans1 = c_x + c_y + 1
	ans2 = z - max(r_x, r_y)
else:
	ans1 = c_x + c_y
	ans2 = 0
print(ans1, ans2)


inp = input().split()
x = int(inp[0])
y = int(inp[1])
z = int(inp[2])
cnt = x // z + y // z
x = x % z
y = y % z
if x > y:
	tmp = x
	x = y
	y = tmp
if x + y >= z:
	rem = z - y
	cnt += 1
else:
	rem = 0
print(str(cnt) + ' ' + str(rem))


(x, y, z) = (int(x) for x in input().split())
num = (x % z + y % z) // z
max_num = x // z + y // z + num
min_num = z - max(x % z, y % z) if x % z + y % z >= z else 0
print(max_num, min_num)


def main():
	(x, y, z) = map(int, input().split())
	a = x // z + y // z
	x %= z
	y %= z
	if x + y < z:
		print(a, 0)
	else:
		print(a + 1, min(z - x, z - y))
	return 0
main()


(x, y, z) = map(int, input().split())
t = (x + y) // z
v = (x + y) % z
print(t, max(min(x % z - v, y % z - v), 0))


(x, y, z) = input().split()
x = int(x)
y = int(y)
z = int(z)
minshare = 0
maxcoco = (x + y) // z
if x // z + y // z < maxcoco:
	big = max(x % z, y % z)
	minshare = z - big
print(maxcoco, end=' ')
print(minshare, end=' ')


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, copy, functools
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
eps = 1.0 / 10 ** 10
mod = 10 ** 9 + 7
dd = [(-1, 0), (0, 1), (1, 0), (0, -1)]
ddn = [(-1, 0), (-1, 1), (0, 1), (1, 1), (1, 0), (1, -1), (0, -1), (-1, -1)]

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

def LLI():
	return [list(map(int, l.split())) for l in sys.stdin.readlines()]

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

def LF():
	return [float(x) for x in sys.stdin.readline().split()]

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

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

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

def S():
	return input()

def pf(s):
	return print(s, flush=True)

def pe(s):
	return print(str(s), file=sys.stderr)

def JA(a, sep):
	return sep.join(map(str, a))

def JAA(a, s, t):
	return s.join((t.join(map(str, b)) for b in a))

def main():
	(x, y, z) = LI()
	t = (x + y) // z
	u = x // z + y // z
	if t == u:
		return '{} {}'.format(t, 0)
	m = min(z - x % z, z - y % z)
	return '{} {}'.format(t, m)
print(main())


(x, y, c) = list(map(int, input().split()))
xtemp = x % c
xcoco = x // c
ytemp = y % c
ycoco = y // c
if (xtemp + ytemp) // c > 0:
	extracoco = (xtemp + ytemp) // c
	s = min(xtemp, ytemp)
	tmp = s - (xtemp + ytemp) % c
else:
	extracoco = 0
	tmp = 0
total = xcoco + ycoco + extracoco
money = tmp
print(total, tmp)


def main():
	(x, y, z) = map(int, input().split())
	print((x + y) // z, max(min(x % z - (x + y) % z, y % z - (x + y) % z), 0))
main()


(a, b, c) = map(int, input().split())
if a % c > b % c:
	a += b % c
	e = b % c - a % c
else:
	b += a % c
	e = a % c - b % c
if e < 0:
	e = 0
print(a // c + b // c, e)


a = input().split()
(x, y, z) = (int(a[0]), int(a[1]), int(a[2]))
total = (x + y) // z
x1 = x // z
y1 = y // z
c = 0
if total > x1 + y1:
	x1 = x % z
	y1 = y % z
	if x1 > y1:
		c = z - x1
	else:
		c = z - y1
print(total, c)


a = [int(x) for x in input().split()]
x = a[0]
y = a[1]
z = a[2]
x1 = x
y1 = y
ans = x // z + y // z
ans1 = 0
xNext = x // z * z + z
yNext = y // z * z + z
if x % z == 0:
	xNext -= z
if y % z == 0:
	yNext -= z
dif = xNext - x
y1 -= dif
if xNext // z + y1 // z > ans:
	ans = xNext // z + y1 // z
	ans1 = dif
dif = yNext - y
x1 -= dif
if yNext // z + x1 // z > ans:
	ans = yNext // z + x1 // z
	ans1 = dif
if yNext // z + x1 // z == ans:
	ans1 = min(ans1, dif)
print(str(ans) + ' ' + str(ans1))


(a, b, c) = map(int, input().split())
ans = (a + b) // c
(x, y) = (a % c, b % c)
if x == 0 or y == 0:
	print(ans, 0)
elif x + y >= c:
	print(ans, min(c - x, c - y))
else:
	print(ans, 0)


(a, b, c) = map(int, input().split())
n = (a + b) // c
r = n - a // c - b // c
if r != 0:
	r = min(a % c, c - a % c, b % c, c - b % c)
print(n, r)


import math
from collections import OrderedDict
from collections import deque
import heapq

def ll(i):
	if i == 0:
		return input()
	if i == 1:
		return list(map(int, input().split()))
p = ll(1)
m1 = p[1] % p[2]
m2 = p[0] % p[2]
ans = (m1 + m2) // p[2]
if ans == 0 and (m1 + m2) % p[2] == 0:
	print((p[0] + p[1]) // p[2], min(m1, m2))
else:
	val = (m1 + m2) % p[2]
	if val == m1 + m2:
		print((p[0] + p[1]) // p[2], 0)
	else:
		print((p[0] + p[1]) // p[2], min(m1, m2) - val)


l = list(map(int, input().split()))
d1 = l[0] // l[2]
d2 = l[1] // l[2]
r1 = l[0] % l[2]
r2 = l[1] % l[2]
n = 0
d = 0
if r1 + r2 >= l[2]:
	max = r1
	if max < r2:
		max = r2
	d = d + 1
	n = l[2] - max
print(d1 + d2 + d, n)


(x, y, z) = input().split()
x = int(x)
y = int(y)
z = int(z)
r1 = x // z
r2 = y // z
e1 = x % z
e2 = y % z
if e1 > e2:
	max = e1
	min = e2
else:
	max = e2
	min = e1
if z - max <= min:
	print(int(r1 + r2 + 1), z - max)
else:
	print(int(r1 + r2), 0)