A tennis tournament with n participants is running. The participants are playing by an olympic system, so the winners move on and the losers drop out.

The tournament takes place in the following way (below, m is the number of the participants of the current round):  let k be the maximal power of the number 2 such that k ≤ m,  k participants compete in the current round and a half of them passes to the next round, the other m - k participants pass to the next round directly,  when only one participant remains, the tournament finishes. 

Each match requires b bottles of water for each participant and one bottle for the judge. Besides p towels are given to each participant for the whole tournament.

Find the number of bottles and towels needed for the tournament.

Note that it's a tennis tournament so in each match two participants compete (one of them will win and the other will lose).


-----Input-----

The only line contains three integers n, b, p (1 ≤ n, b, p ≤ 500) — the number of participants and the parameters described in the problem statement.


-----Output-----

Print two integers x and y — the number of bottles and towels need for the tournament.


-----Examples-----
Input
5 2 3

Output
20 15

Input
8 2 4

Output
35 32



-----Note-----

In the first example will be three rounds:  in the first round will be two matches and for each match 5 bottles of water are needed (two for each of the participants and one for the judge),  in the second round will be only one match, so we need another 5 bottles of water,  in the third round will also be only one match, so we need another 5 bottles of water. 

So in total we need 20 bottles of water.

In the second example no participant will move on to some round directly.

Difficulty: EASY
Tags: Mathematics

Implementation

Starter code:

Solutions:
s = input()
a = s.split()
n = int(a[0])
b = int(a[1])
p = int(a[2])
t = n
c = 1
sm = 0
while n != 1:
	while True:
		if c * 2 > n:
			break
		c *= 2
	sm = sm + c // 2 + c * b
	n -= c // 2
	c = 1
print(sm, t * p, end=' ')


import math
(n, b, p) = map(int, input().split())
tot = 0
towels = p * n
while n != 1:
	x = pow(2, int(math.log2(n)))
	tot += b * x + x // 2
	n -= x // 2
print(tot, towels)


(n, b, p) = input().split()
(n, b, p) = (int(n), int(b), int(p))
y = n * p
tot_kamper = 0
for i in range(1, 100):
	if n == 1:
		x = tot_kamper
	elif n % 2 == 0:
		rundekamper = int(n / 2)
		n = int(n / 2)
		tot_kamper += rundekamper
	elif n % 2 == 1:
		rundekamper = int(n / 2)
		n = int(n / 2) + 1
		tot_kamper += rundekamper
x = tot_kamper * b * 2 + tot_kamper
print(f'{x} {y}')


def f(l):
	(n, b, p) = l
	return [(n - 1) * (b + b + 1), n * p]
l = list(map(int, input().split()))
print(*f(l))


from math import log as lg
(n, b, p) = map(int, input().split(' '))
bottle = 0
k = pow(2, int(lg(n, 2)))
towel = n * p
while k >= 2:
	bottle += k * b + int(k / 2)
	n = int(k / 2) + n - k
	if n > 0:
		k = pow(2, int(lg(n, 2)))
print(bottle, towel)


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


from math import *
(n, b, p) = map(int, input().split())
n2 = n
r = 0
while True:
	if n == 1:
		break
	c = floor(log(n) / log(2))
	k = 2 ** c
	r += k * b + k // 2 * 1
	postup = n - k
	n = k // 2 + postup
print(r, n2 * p)


from math import log2, ceil
(n, p, t) = map(int, input().split())
match_count = 0
tot = t * n
while n > 1:
	f = int(log2(n))
	k = 2 ** f
	l = k // 2
	match_count += l
	n -= l
print(match_count * 2 * p + match_count, tot)


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


(n, b, p) = map(int, input().split())
y = n
ans = 0
while n != 1:
	x = 0
	while 2 ** x <= n:
		x += 1
	x -= 1
	ans += 2 ** (x - 1)
	n -= 2 ** (x - 1)
print(ans * (2 * b + 1), y * p)


(n, b, p) = list(map(int, input().strip().split()))
m = 0
g = n * p
while n > 1:
	i = 1
	while 2 ** i <= n:
		i += 1
	i -= 1
	m += 2 ** (i - 1)
	n = n - 2 ** (i - 1)
print(str(m * (2 * b + 1)) + ' ' + str(g))


def next(x):
	k = 0
	while x > 1:
		x //= 2
		k += 1
	return k

def st(x):
	k = 1
	for i in range(x):
		k *= 2
	return k
(n, b, p) = map(int, input().split())
ans = 0
ll = n * p
while n != 1:
	k = st(next(n))
	n -= k
	n += k // 2
	ans += k // 2 * 2 * b
	ans += k // 2
print(ans)
print(ll)


import math
(n, b, p) = map(int, input().split())
y = p * n
c = 0
while n > 2:
	c += int(n // 2)
	n = n // 2 + n % 2
if n == 2:
	c += 1
x = int((2 * b + 1) * c)
print(x, y)


(n, b, p) = map(int, input().split())
(c, v) = (n, 0)
while c > 1:
	k = 2
	while 2 * k <= c:
		k *= 2
	c -= k // 2
	v += k * b + k // 2
print(v, n * p)


(n, b, p) = map(int, input().split())
n1 = n
import math
k = int(math.log(n, 2))
mat = 0
while n > 1:
	n -= 2 ** (k - 1)
	mat += 2 ** (k - 1)
	k = int(math.log(n, 2))
print(mat * (2 * b + 1), p * n1)


(n, b, p) = map(int, input().split())
(b_res, p_res) = (0, n * p)
while n > 1:
	tmp = 2
	while 2 * tmp <= n:
		tmp *= 2
	b_res += tmp * b
	b_res += tmp // 2
	n = n - tmp // 2
print(b_res, p_res)


k = list(map(int, input().split()))
n = k[0]
b = k[1]
p = k[2]
print((n - 1) * 2 * b + (n - 1), n * p)


(n, b, p) = map(int, input().split())
g1 = 2 * b + 1
g2 = 2 * p
print((n - 1) * g1, n * p)


(n, b, p) = [int(x) for x in input().split()]
(b1, p1) = (0, n * p)
while n > 1:
	n1 = 2 << n.bit_length() - 2
	b1 += (2 * b + 1) * n1 // 2
	n -= n1 // 2
print(b1, p1)


import math
(n, b, p) = [int(x) for x in input().split(' ')]
t = n * p
m = 0
while n > 1:
	m += 2 ** (math.floor(math.log(n, 2)) - 1)
	n -= 2 ** (math.floor(math.log(n, 2)) - 1)
print(m * (2 * b + 1), t)


def main():
	(n, b, p) = map(int, input().split())
	print((n - 1) * (2 * b + 1), n * p)
main()


(n, b, p) = map(int, input().split())
bot = 2 * b + 1
to = p * n
bo = 0
if n == 1:
	print(0, to)
else:
	while n > 1:
		for k in range(1, 11):
			u = 2 ** k
			if u < n:
				pass
			else:
				if u == n:
					bo += n // 2 * bot
					n = 2 ** (k - 1)
				else:
					bo += 2 ** (k - 2) * bot
					h = n - 2 ** (k - 1)
					n = 2 ** (k - 2) + h
				break
	print(bo, to)


(n, b, p) = map(int, input().split())
m = n
nmatches = 0
while m > 1:
	power = 0
	k = pow(2, power)
	while k < m:
		power += 1
		k = pow(2, power)
	if k > m:
		k = pow(2, power - 1)
	nmatches += k / 2
	m = k / 2 + (m - k)
print(str(int(b * nmatches * 2 + nmatches)) + ' ' + str(int(p * n)))


from math import ceil, log
(n, b, p) = map(int, input().split())
max_participent = int(n)
ans_bottle = 0
while max_participent > 1:
	ans_bottle += max_participent // 2 * 2 * b + max_participent // 2
	max_participent = max_participent // 2 + max_participent % 2
print(ans_bottle, p * n)


(N, B, P) = map(int, input().split())
x = (2 * B + 1) * (N - 1)
y = P * N
print(x, y)


def read():
	return [int(s) for s in input().split()]
(n, b, p) = read()
print((n - 1) * (2 * b + 1), n * p)


(p, a, t) = map(int, input().split())
t1 = (p - 1) * 2 * a + (p - 1)
t2 = t * p
print(t1, t2)


a = list(map(int, input().split()))
l = 0
p = 0
n = a[0]
while 1:
	if n == 1:
		break
	if n % 2 != 0:
		l = 1
		n -= 1
	c = n // 2
	p = p + c * a[1] * 2 + c
	n = n // 2
	if n % 2 != 0:
		if l == 1:
			n += 1
			l = 0
if l == 1:
	print(p + (a[1] * 2 + 1), (a[0] + 1) * a[2], end=' ')
else:
	print(p, a[0] * a[2], end=' ')


import fileinput

def test():
	pass
num_args = 1
for arg in range(num_args):
	(n, b, p) = map(int, input().split())
m = n
num_matches = m // 2
extras = abs(-m // 2) - num_matches
sum_b = num_matches * 2 * b + num_matches
sum_p = n * p
while num_matches > 0:
	m = num_matches + extras
	num_matches = m // 2
	extras = abs(-m // 2) - num_matches
	sum_b += num_matches * 2 * b + num_matches
print(sum_b, sum_p)


import queue
import math
import io
s = [2, 4, 8, 16, 32, 64, 128, 256, 512]

def step(n):
	st = 0
	for i in range(len(s)):
		if s[i] > n:
			st = s[i - 1]
			break
	return [n - st + st // 2, st // 2]
[n, b, p] = [int(x) for x in input().split(' ')]
res = 0
res_p = n * p
while n > 1:
	[n, rb] = step(n)
	res += rb * 2 * b + rb
print(str(res) + ' ' + str(res_p))


import math
(n, bottles, towels) = map(int, input().split())
num = n
cnt = 0
while n != 1:
	cnt += math.floor(math.log2(n))
	n -= math.floor(math.log2(n))
print(cnt * bottles * 2 + cnt, num * towels)


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

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

def pt(x):
	print(x)

def ip():
	return input()

def it():
	return int(input())

def sl(x):
	return [t for t in x]

def spl(x):
	return x.split()

def aj(liste, item):
	liste.append(item)

def bin(x):
	return '{0:b}'.format(x)

def listring(l):
	return ' '.join([str(x) for x in l])

def printlist(l):
	print(' '.join([str(x) for x in l]))
(n, b, p) = mp()
match = 2 * b + 1
towel = n * p
result = 0
while n > 1:
	x = 2 ** (len(bin(n)) - 2)
	result += match * x
	n -= x
print('%d %d' % (result, towel))


import logging
import copy
import sys
logging.basicConfig(stream=sys.stderr, level=logging.DEBUG)

def solve(firstLine):
	(n, b, p) = (firstLine[0], firstLine[1], firstLine[2])
	sumB = 0
	sumP = n * p
	while n > 1:
		k = 2
		while k * k < n:
			k *= k
		sumB += b * k + k // 2
		log(n, k, sumB, sumP)
		n = k // 2 + (n - k)
	print(sumB, sumP)
	return

def main():
	firstLine = input().split()
	firstLine = list(map(int, firstLine))
	solve(firstLine)

def log(*message):
	logging.debug(message)
main()


import math
(n, b, p) = map(int, input().split(' '))
print((2 * b + 1) * (n - 1), p * n)


(n, b, p) = map(int, input().split())
towels = n * p
bottles = 0
while n > 1:
	k = n >> 1
	bottles += k * (2 * b + 1)
	n -= k
print(bottles, towels)


def s(m):
	k = 1
	while k <= m:
		k = k * 2
	return k // 2
p = input()
p = p.split()
n = int(p[0])
b = int(p[1])
o = int(p[2])
j = 0
h = n * o
while n != 1:
	a = n
	n -= s(n) / 2
	j += s(a) * (2 * b + 1) // 2
print(str(j) + ' ' + str(h))


from math import *
(n, b, p) = map(int, input().split())
(qb, qp) = (0, n * p)
while n != 1:
	now = 2 ** int(log2(n))
	qb += now * b + now / 2
	n -= now / 2
print(int(qb), qp)


ans = input().split()
ans = list(map(int, ans))
n = ans[0]
b = ans[1]
p = ans[2]
x = 0
y = 0

def round(n):
	global x
	s = 1
	if n == 1:
		return
	else:
		while 2 ** s < n:
			s += 1
		if 2 ** s > n:
			s -= 1
		k = 2 ** s
		x += k * b + k / 2
		m = int(k / 2 + (n - k))
		round(m)
round(n)
print(int(x), n * p)


def one_case():
	(n, b, p) = map(int, input().split())
	y = n * p
	x = 0
	while n > 1:
		(q, w) = (n // 2 * 2, n // 2)
		x += q * b + w
		n = n - n // 2
	print(x, y)
one_case()


(n, b, p) = map(int, input().split())
k = 2
cnt = 0
while n > k:
	if k * 2 > n:
		break
	else:
		k *= 2
c = n % k
k = k - 1 + c
if n > 1:
	print(k * b * 2 + k, n * p)
else:
	print(0, n * p)


(n, b, p) = list(map(int, input().split()))
ansb = p * n
if n == 1:
	print(0, ansb)
else:
	k = 2
	while 2 * k <= n:
		k *= 2
	ansa = 0
	while n > 1:
		k //= 2
		ansa += b * 2 * k + k
		n -= k
		while 2 * k <= n:
			k *= 2
		while k > n:
			k //= 2
	print(ansa, ansb)


(n, b, p) = map(int, input().split())
x = (n - 1) * (2 * b + 1)
y = p * n
print(x, y)


l = [int(x) for x in input().split(' ')]
(n, b, p) = l
res1 = 0
res2 = n * p
while not n == 1:
	k = 0
	while 2 ** (k + 1) <= n:
		k += 1
	res1 += 2 ** k * b + 2 ** (k - 1)
	n -= 2 ** (k - 1)
print(res1, res2)


(n, b, p) = map(int, input().split())
p *= n
g = 0
while n > 1:
	x = 1
	while 4 * x <= n:
		x *= 2
	g += x
	n -= x
print(g * (2 * b + 1), p)


import math
(n, b, p) = map(int, input().split())
m = n
bottles = 0
papers = p * n
while m > 1:
	k = 2 ** math.floor(math.log(m, 2))
	bottles += k * b
	bottles += k // 2
	m = m - k + k // 2
print(bottles, papers)


from math import log2
(n, b, p) = map(int, input().split())
(res_b, m) = (0, n)
while m > 1:
	in_match = 2 ** int(log2(m))
	go_through = int(m - in_match)
	res_b += int(b * in_match + in_match / 2)
	m = int(in_match / 2 + go_through)
print(res_b, p * n)


def f(m):
	k = 0
	while 2 ** k <= m:
		k += 1
	return 2 ** (k - 1)
(n, water, towel) = map(int, input().split())
towel *= n
wans = 0
while n > 1:
	k = f(n)
	n = k // 2 + n - k
	wans += k * water + k // 2
print(wans, towel)


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


(n, b, p) = map(int, input().split())
ans_b = 0
ans_p = n * p
while n != 1:
	kol_m = n // 2
	ans_b += kol_m * (2 * b + 1)
	n = n - n // 2
print(ans_b, ans_p)


(m, n, p) = map(int, input().split())
v1 = (m - 1) * (2 * n + 1)
v2 = p * m
print(v1, v2)


(n, b, p) = map(int, input().split())
twos = []
for i in range(1, 9):
	twos.append(pow(2, i))

def getk(m):
	for x in twos[::-1]:
		if x <= m:
			return x
	return -1
matches = 0
m = n
while m > 1:
	k = getk(m)
	m = k // 2 + m - k
	matches += k // 2
print(matches * (2 * b + 1), n * p)


(n, b, p) = input().split()
n = int(n)
b = int(b)
p = int(p)
print((n - 1) * 2 * b + (n - 1), end=' ')
print(n * p)


from __future__ import division, print_function

def solver(ifs):
	from math import log2
	(n, b, p) = list(map(int, ifs.readline().split()))
	towels = p * n
	bottles = 0
	while n > 1:
		a = int(log2(n + 1))
		c = 2 ** a
		bottles += c * b + c // 2
		n = n - c // 2
	print(bottles, towels)

def main():
	import sys
	if sys.version_info.major == 3:
		from io import StringIO as StreamIO
	else:
		from io import BytesIO as StreamIO
	with StreamIO(sys.stdin.read()) as ifs, StreamIO() as ofs:
		_stdout = sys.stdout
		sys.stdout = ofs
		solver(ifs)
		sys.stdout = _stdout
		sys.stdout.write(ofs.getvalue())
	return 0
main()


import sys

def findK(m):
	for k in range(m * 2):
		if 2 ** k > m:
			if k == 0:
				return 1
			else:
				return 2 ** (k - 1)
inputs = list(map(int, input().split()))
(n, b, p) = inputs
m = n
bottles = 0
while m > 1:
	k = findK(m)
	bottles += b * k + k // 2
	m = k // 2 + (m - k)
print(bottles, n * p)


def highest_2power(n):
	while n & n - 1 > 0:
		n &= n - 1
	return n
(n, b, p) = map(int, input().split())
bottles = 0
towels = n * p
while n > 1:
	hp = highest_2power(n)
	matches = hp // 2
	bottles += b * hp + matches
	n -= matches
print(bottles, towels)


import math

def gcd(a, b):
	if a < b:
		(a, b) = (b, a)
	while a % b != 0:
		(a, b) = (b, a % b)
	return b
(n, b, p) = map(int, input().split())
ans = 0
n0 = n * 1
while n > 1:
	k = 2 ** int(math.log2(n))
	ans += k // 2 + b * k
	n = n - k // 2
print(ans, n0 * p)


(n, b, p) = input().split()
(n, b, p) = (int(n), int(b), int(p))
y = n * p
matches = 0
while n > 1:
	if n % 2 == 0:
		n = n // 2
		matches += n
	else:
		n = n // 2 + 1
		matches += n - 1
print(matches * (2 * b + 1), y)


nbp = list(map(int, input().split()))
n = nbp[0]
b = nbp[1]
p = nbp[2]
m = n
a = 0
while m > 1:
	for i in range(m):
		if 2 ** i <= m:
			k = 2 ** i
		else:
			break
	a = a + k * b + k // 2
	m = m - k + k // 2
print(a, n * p)


from math import log
(n, b, p) = map(int, input().split())
towels = n * p
bottles = 0
while n > 1:
	bottles = bottles + b * 2 ** int(log(n, 2)) + 2 ** int(log(n, 2)) // 2
	n = n - 2 ** int(log(n, 2)) // 2
print(bottles, towels)


import math

def hp2(n):
	p = int(math.log(n, 2))
	return int(pow(2, p))
(n, b, p) = [int(x) for x in input().split()]
towels = p * n
bottles = 0
k = 0
m = n
while m != 1:
	k = hp2(m)
	bottles += b * k + k / 2
	m = m - k + k / 2
print(int(bottles), towels)


import math
(n, b, p) = [int(i) for i in input().split()]
towels = n * p
bottles = 0

def less_power2(num):
	return 2 ** int(math.log(num, 2))
m = n
while m > 1:
	k = less_power2(m)
	bottles += k * b + k // 2
	m -= k // 2
print(bottles, towels)


(n, b, p) = map(int, input().split())
x = n
s = 0
for i in range(1, 10000):
	if x % 2 == 0:
		if x > 0:
			x = x // 2
			s += (b * 2 + 1) * x
		else:
			break
	if x % 2 != 0 and x > 0:
		if x > 0:
			x = x // 2 + 1
			s += (b * 2 + 1) * (x - 1)
		else:
			break
print(s, n * p)


(n, b, p) = map(int, input().split())
bm = b * 2 + 1
p *= n
q_of_pairs = 0
while n != 1:
	k = 0
	while 2 ** (k + 1) <= n:
		k += 1
	q_of_pairs += 2 ** k // 2
	n -= 2 ** k // 2
print(q_of_pairs * bm, p)


(n, b, p) = map(int, input().split())
prevOdd = 0
if n % 2 == 0:
	prevOdd = 1
(i, bot) = (n, 0)
while i != 1:
	if i % 2 == 0:
		prevOdd = 0
		i = i // 2
		bot += i + 2 * i * b
	else:
		prevOdd = 1
		i = i // 2
		bot += i + 2 * i * b
	if prevOdd == 1:
		i += 1
print(bot, n * p)


s = input()
s = s.split(' ')
n = int(s[0])
b = int(s[1])
p = int(s[2])
y = n * p
k = 0

def max(m):
	res = 1
	while m >= res:
		res *= 2
	return res / 2
while n > 1:
	k += max(n) / 2
	n -= max(n) / 2
print(int(k * (2 * b + 1)), y, sep=' ')


def Func():
	(players, bottles, towels) = map(int, input().split())
	totalBottles = 0
	totalTowels = players * towels
	while players > 1:
		for i in range(players, 0, -1):
			if 2 ** i <= players:
				roundmatches = 2 ** i // 2
				break
		players -= roundmatches
		totalBottles += (1 + bottles * 2) * roundmatches
	print(totalBottles, totalTowels)
Func()


x = input()
(players, b, p) = x.split()
players = int(players)
b = int(b)
p = int(p)
t = players * p
counter = 0
for i in range(1, 1000):
	if players == 1:
		break
	if players % 2 == 0:
		players = players // 2
		counter += players
	else:
		players -= 1
		players = players // 2
		counter += players + 1
print(counter * 2 * b + counter, t)


(n, b, p) = map(int, input().split())
r1 = 0
r2 = p * n
while n != 1:
	curr = 1
	while curr * 2 <= n:
		curr *= 2
	n -= curr // 2
	r1 += curr * b + curr // 2
print(r1, r2)


ch = input()
d = ch.split(' ')
n = int(d[0])
b = int(d[1])
p = int(d[2])
towels = p * n
bottle = b * 2 + 1
S = 0
n1 = n
while n1 > 1:
	S = S + n1 // 2
	n1 = n1 // 2 + n1 % 2
print(S * bottle, towels)


nbp = input().split()
n = int(nbp[0])
b = int(nbp[1])
p = int(nbp[2])
c = 0
v = p * n
while n != 1:
	if n % 2 == 0:
		c = c + int(n * b + n / 2)
		n = n / 2
	else:
		c = c + int((n - 1) * b + (n - 1) / 2)
		n = int((n - 1) / 2 + 1)
print(c, v)


import math
from math import *
(n, b, p) = map(int, input().split(' '))
ansb = 0
ansp = p * n
while n > 1:
	t = floor(log(n) / log(2))
	m = 2 ** t
	ansb += (2 * b + 1) * (m / 2)
	n -= m / 2
print(int(ansb), int(ansp))


def round_num_of_bottles(kk, bb):
	kkk = kk // 2
	return kkk * bb * 2 + 1 * kkk
line1 = str(input()).split()
n = int(line1[0])
b = int(line1[1])
p = int(line1[2])
curr_round = 0
m = n
bottles = 0
while m > 1:
	curr_round += 1
	k = 2
	while k <= m:
		k *= 2
	k //= 2
	pass1 = k // 2
	pass2 = m - k
	m = pass1 + pass2
	bottles += round_num_of_bottles(k, b)
print(bottles, n * p)


import math
numbers = input().split(' ')
for n in range(len(numbers)):
	numbers[n] = int(numbers[n])
participants = numbers[0]
numMatches = 0
while participants > 1:
	numMatches += math.floor(participants / 2)
	participants = math.ceil(participants / 2)
numBottles = numMatches * numbers[1] * 2 + numMatches
numTowels = numbers[0] * numbers[2]
print(str(numBottles) + ' ' + str(numTowels))


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


(n, b, p) = map(int, input().split())
m = n
ans = 0
while n > 1:
	ans += n // 2
	n += n % 2
	n //= 2
print(ans * (1 + b * 2), m * p)


(n, b, p) = map(int, input().split())
pi = p * n
bi = 0
while n > 1:
	m = pow(2, len(bin(n)) - 3)
	bi += m // 2 * (b * 2 + 1)
	n -= m // 2
print(bi, end=' ')
print(pi)


(n, b, p) = map(int, input().split())
r = 0
t = n * p
import math
while n != 1:
	k = 2 ** math.floor(math.log(n, 2))
	r += k // 2 * (2 * b + 1)
	n -= k // 2
print(r, t)


import sys
import math

def main():
	(n, b, p) = map(int, input().split())
	cur = n
	c = 0
	while cur != 1:
		k = 2
		while k * 2 <= cur:
			k *= 2
		cur = cur - k + k // 2
		c += k // 2
	print(c * (2 * b + 1), n * p)
main()


(n, b, p) = map(int, input().split())
tow = n * p
bot = 0
while n > 1:
	ex = n % 2
	n = n - ex
	bot += n * b + n // 2
	n = n // 2
	n = n + ex
print(bot, tow)


def do_1():
	(n, b, p) = map(lambda x: int(x), input().split(' '))
	print((2 * b + 1) * (n - 1), p * n)
do_1()


(n, b, p) = map(int, input().split())
res2 = n * p
res1 = 0
while n > 1:
	res1 += n // 2 * (2 * b + 1)
	n -= n // 2
print(res1, res2)


from math import log, floor

def get_bottles(n, b):
	bpg = 2 * b + 1
	gp = n - 1
	return bpg * gp
nums = [int(i) for i in input().split(' ')]
n = nums[0]
b = nums[1]
p = nums[2]
towels = n * p
bottles = get_bottles(n, b)
print('{} {}'.format(bottles, towels))


(n, b, p) = list(map(int, input().split()))
b_sum = 0
p_sum = p * n
import math
while n > 1:
	b_sum += (2 * b + 1) * int(math.log2(n))
	n -= int(math.log2(n))
print(b_sum, p_sum)


p = input().rstrip().split(' ')
a = int(p[0])
b = int(p[1])
c = int(p[2])
b = b * 2 + 1
print(b * (a - 1), c * a)


ans = input().split()
ans = list(map(int, ans))
n = ans[0]
b = ans[1]
p = ans[2]
m = n - 1
x = m * (b * 2 + 1)
y = n * p
print(x, y)


n = input().split(' ')
b = int(n[1])
p = int(n[2])
n = int(n[0])
pcount = p * n
bcount = 0
matchcount = 0
while n != 1:
	q = 2
	while q <= n:
		q *= 2
	q = q // 4
	bcount += (2 * b + 1) * q
	matchcount += q
	n = n - q
print(str(bcount) + ' ' + str(pcount))


import math
(n, b, p) = [int(i) for i in input().split()]
matches_count = 0
towels = n * p
while n > 1:
	power = int(math.log2(n))
	matches_count += power
	n = n - power
bottles = matches_count * (2 * b + 1)
print(bottles, towels)


import sys
import bisect
from bisect import bisect_left as lb
input_ = lambda : sys.stdin.readline().strip('\r\n')
from math import log
from math import gcd
from math import atan2, acos
from random import randint
sa = lambda : input_()
sb = lambda : int(input_())
sc = lambda : input_().split()
sd = lambda : list(map(int, input_().split()))
se = lambda : float(input_())
sf = lambda : list(input_())
flsh = lambda : sys.stdout.flush()
mod = 10 ** 9 + 7
gp = []
cost = []
dp = []
mx = []
ans1 = []
ans2 = []
special = []
specnode = []
a = 0
kthpar = []

def dfs(root, par):
	if par != -1:
		dp[root] = dp[par] + 1
	for i in range(1, 20):
		if kthpar[root][i - 1] != -1:
			kthpar[root][i] = kthpar[kthpar[root][i - 1]][i - 1]
	for child in gp[root]:
		if child == par:
			continue
		kthpar[child][0] = root
		dfs(child, root)

def hnbhai():
	(n, b, p) = sd()
	print((n - 1) * (2 * b + 1), n * p)
for _ in range(1):
	hnbhai()


import math
line = input()
(player_count, bottles, towels) = line.split()
(player_count, bottles, towels) = (int(player_count), int(bottles), int(towels))
bracket_size = math.ceil(player_count / 2)
match_count = player_count - 1
bottles_per_match = bottles * 2 + 1
final_bottle_count = bottles_per_match * match_count
final_towel_count = player_count * towels
print(final_bottle_count, final_towel_count)


(n, b, p) = map(int, input().split())
ansb = 0
anst = n * p
while n > 1:
	x = n // 2
	y = n % 2
	n -= x
	ansb += b * x * 2 + x
print(ansb, anst)


import sys
input = sys.stdin.readline
(n, b, p) = map(int, input().split())
x = (n - 1) * (2 * b + 1)
y = n * p
print(x, y)


(n, b, p) = list(map(int, input().split()))
import math
(water, towel) = (0, n * p)
while n > 1:
	water += int(math.pow(2, int(math.log(n, 2)))) * b + int(math.pow(2, int(math.log(n, 2)))) // 2
	n -= math.pow(2, int(math.log(n, 2))) // 2
print(water, towel)


(n, b, p) = map(int, input().split())
m = n
ans = 0
while m > 1:
	lb = 0
	rb = 10
	while lb != rb:
		mb = (lb + rb + 1) // 2
		if 2 ** mb <= m:
			lb = mb
		else:
			rb = mb - 1
	ans += 2 ** lb * b + 2 ** (lb - 1)
	m -= 2 ** (lb - 1)
print(ans, n * p)


y = input().split()
i = list(map(int, y))
n = i[0]
b = i[1]
p = i[2]
x = (n - 1) * (2 * b + 1)
y = n * p
print(x, y)


read = lambda : map(int, input().split())
(n, b, p) = read()
y = p * n
x = 0
while n > 1:
	p = 0
	while 2 ** p <= n:
		p += 1
	k = 2 ** (p - 1)
	x += k // 2 * (2 * b + 1)
	n = n - k + k // 2
print(x, y)


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')

def isPrime(n):
	if n <= 1:
		return False
	if n <= 3:
		return True
	if n % 2 == 0 or n % 3 == 0:
		return False
	i = 5
	while i * i <= n:
		if n % i == 0 or n % (i + 2) == 0:
			return False
		i = i + 6
	return True
(n, b, p) = map(int, input().split())
towels = n * p
bottle = (n - 1) * (2 * b + 1)
print(bottle, towels)


def main():
	(n, b, p) = map(int, input().split())
	(k, x) = (1 << n.bit_length(), 0)
	p *= n
	while n > 1:
		while k > n:
			k //= 2
		x += k
		n -= k // 2
	print(x * (b * 2 + 1) // 2, p)
main()


n = str(input())
n = n + ' '
i = 0
s = ''
c = 0
while i < len(n):
	if n[i] != ' ':
		s = s + n[i]
	else:
		if c == 0:
			m = int(s)
		if c == 1:
			b = int(s)
		if c == 2:
			p = int(s)
		c = c + 1
		s = ''
	i = i + 1
if m >= 1 and m <= 500 and (p >= 1) and (p <= 500) and (b >= 1) and (b <= 500):
	sb = 0
	sp = m * p
	while m != 1:
		k = m // 2 * 2
		sb = sb + k * b + 0.5 * k
		m = m - 0.5 * k
	sb = int(sb)
	print(sb, sp)
else:
	print('invalid input')


from math import *
(n, b, p) = map(int, input().split())
m = n
ct = 0
while n > 1:
	x = 1 << int(log2(n)) - 1
	ct += x
	n -= x
print((2 * b + 1) * ct, p * m)


s = input().split()
n = int(s[0])
b = int(s[1])
p = int(s[2])
print((n - 1) * (2 * b + 1))
print(n * p)


def tennis():
	tempInput = input().split()
	bottles = int(tempInput[1])
	players_remaining = int(tempInput[0])
	games = 0
	while players_remaining > 1:
		temp = 2 ** (players_remaining.bit_length() - 1)
		players_remaining -= int(temp / 2)
		games += int(temp / 2)
	print(games * (2 * bottles + 1), int(tempInput[0]) * int(tempInput[2]))
tennis()


def calc_power_of_2(m):
	x = 0
	while m >= 2 ** (x + 1):
		x += 1
	return 2 ** x

def main_function():
	(n, b, p) = [int(i) for i in input().split(' ')]
	towels = n * p
	bottles = 0
	while n != 1:
		k = calc_power_of_2(n)
		bottles += (2 * b + 1) * k // 2
		n -= k // 2
	print(str(bottles) + ' ' + str(towels))
main_function()


list1 = []
str1 = input()
list2 = str1.split(' ')
list2_length = len(list2)
x = 0
while x <= list2_length - 1:
	list1.append(int(list2.pop()))
	x += 1
list1.reverse()
n = list1[0]
b = list1[1]
p = list1[2]
print((n - 1) * (b * 2 + 1), n * p)


(n, b, p) = list(map(int, input().split()))
ans1 = 0
ans2 = p * n
while n != 1:
	k = 1
	while k * 2 <= n:
		k *= 2
	ans1 += k // 2 + b * k
	n -= k // 2
print(ans1, ans2)


(n, b, p) = map(int, input().split())
answer1 = 0
answer2 = n
while n > 1:
	k = 1
	while k < n:
		k *= 2
	answer1 += k * b + k // 2
	n = k // 2 + n - k
print(answer1, answer2 * p)


import sys

def find_k(n):
	k = 1
	while k * 2 <= n:
		k *= 2
	return k

def solve(n, b, p):
	(nb_bottles, nb_towels) = (0, n * p)
	while n > 1:
		k = find_k(n)
		rest = n - k
		nb_matchs = k // 2
		nb_bottles += k * b + nb_matchs
		n = k // 2 + rest
	return (nb_bottles, nb_towels)
assert solve(5, 2, 3) == (20, 15)
assert solve(8, 2, 4) == (35, 32)
(n, b, p) = map(int, sys.stdin.readline().strip().split(' '))
(nb_bottles, nb_towels) = solve(n, b, p)
print('{} {}'.format(nb_bottles, nb_towels))


(n, b, p) = map(int, input().split())
(ans1, ans2) = (0, n * p)
while n != 1:
	power = 1
	while power * 2 <= n:
		power *= 2
	ans1 += (2 * b + 1) * (power // 2)
	n = power // 2 + n - power
print(ans1, ans2)


(n, b, p) = map(int, input().split())
m = n
bottles = 0
towels = 0
players = n
while m > 1:
	k = max([2 ** i for i in range(m + 1) if 2 ** i <= m])
	bottles += (2 * b + 1) * (k // 2)
	players = 0
	players += k // 2
	players += m - k
	m = players
print(str(bottles) + ' ' + str(p * n))


a = input().split(' ')
n = int(a[0])
b = int(a[1])
p = int(a[2])
essuies = p * n

def somme(a):
	if a == 0:
		return 0
	else:
		return a + somme(a - 1)

def grpuis2(a):
	while 1:
		for x in range(0, 9):
			x = 10 - x
			if 2 ** x <= a:
				return x
score = 0
while n > 1:
	m = n % 2
	n = n // 2
	score += n
	n += m
eau = (2 * b + 1) * score
liste = [str(eau), str(essuies)]
print(' '.join(liste))


import sys
(N, B, P) = map(int, sys.stdin.readline().rstrip().split(' '))
now = N
cnt = 0
while now != 1:
	if now % 2 == 1:
		now //= 2
		cnt += now
		now += 1
	else:
		now //= 2
		cnt += now
print('%d %d' % (cnt * (B * 2 + 1), N * P))


(n, b, p) = map(int, input().split())
m = n
s = 0
while m > 1:
	k = 1
	while k * 2 <= m:
		k *= 2
	s += k * b + k // 2
	m -= k // 2
print(s, n * p)


from math import log
(n, b, c) = map(int, input().split())
ni = n
ans = 0
cur = 0
while n > 1:
	k = 2 ** int(log(n, 2))
	ans += k * b + k / 2
	n = k / 2 + n - k
print(int(ans), ni * c)


(n, b, p) = map(int, input().split())
z = n
count = 0
while n != 1:
	q = n // 2
	count += 2 * q * b + q
	n = q + n % 2
print(count, z * p)


(n, b, p) = [int(t) for t in input().split()]
print((n - 1) * (2 * b + 1), n * p)


def find_smallest_power_of_two(number):
	power = 1
	while power * 2 <= number:
		power *= 2
	return power
(players, bottles_per_player, towels_per_player) = map(int, input().split(' '))
bottles_needed = 0
towels_needed = towels_per_player * players
while players > 1:
	competing_players = find_smallest_power_of_two(players)
	bottles_needed += competing_players * bottles_per_player + competing_players // 2
	players -= competing_players // 2
answer = ' '.join([str(bottles_needed), str(towels_needed)])
print(answer)


import sys
(n, b, p) = map(int, input().split())
m = 0
towel = n * p
while n > 1:
	m += n // 2
	n -= n // 2
print(m * 2 * b + m, towel)


def func(n):
	if n < 2:
		return 0
	if n == 2:
		return 1
	k = int(n / 2)
	remain = n - k * 2
	return k + func(k + remain)
inf = list(map(int, input().split()))
(n, b, p) = (inf[0], inf[1], inf[2])
water = 2 * b + 1
match = func(n)
print(match * water, n * p)


(n, b, p) = map(int, input().split())
pa = n
match = 0
while pa != 1:
	match += int(pa / 2)
	pa = pa % 2 + int(pa / 2)
print(f'{match * (2 * b + 1)} {p * n}')


import sys
import math
import itertools
import functools
import collections
import operator
import fileinput
import copy
ORDA = 97

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

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

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

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

def revn(n):
	return str(n)[::-1]

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

def ddl():
	return collections.defaultdict(list)

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

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

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

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

def convn(number, base):
	newnumber = 0
	while number > 0:
		newnumber += number % base
		number //= base
	return newnumber

def cdiv(n, k):
	return n // k + (n % k != 0)
(n, b, p) = mi()
pans = n * p
bans = 0
while n > 1:
	t = int(math.log(n, 2))
	bans += b * 2 ** t + 2 ** (t - 1)
	n -= 2 ** (t - 1)
print(bans, pans)


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


__author__ = 'Girish'
import math
(n, b, p) = [int(x) for x in input().split()]
towels = p * n
current = n
bottles = 0
while current > 1:
	val = int(math.log2(current))
	bottles += 2 ** val * b + 2 ** val // 2
	current = 2 ** val // 2 + (current - 2 ** val)
print(bottles, towels)


(n, b, p) = map(int, input().split())

def getk(m):
	k = 1
	while k * 2 <= m:
		k *= 2
	return k
matches = 0
m = n
while m > 1:
	k = getk(m)
	m = k // 2 + m - k
	matches += k // 2
print(matches * (2 * b + 1), n * p)


from math import floor
(num_players, b, p) = map(int, input().split(' '))
(matches, bottles, towels) = (0, 0, 0)
players = int(num_players)
while players != 1:
	matches += floor(players / 2)
	players -= floor(players / 2)
bottles = matches * (2 * int(b) + 1)
towels = p * int(num_players)
print(bottles, end=' ')
print(towels)


from math import ceil
X = list(map(int, input().split()))
(Towel, Bottle) = (0, 0)
Towel = X[0] * X[2]
while X[0] != 1:
	Bottle += X[0] // 2 * (X[1] * 2 + 1)
	X[0] = ceil(X[0] / 2)
print(Bottle, Towel)


def power_of_two(n):
	sqr = 1
	while sqr <= n:
		sqr = sqr * 2
	return sqr // 2
(n, b, p) = map(int, input().split())
kol_b = 0
kol_p = n * p
m = n
while m > 1:
	k = power_of_two(m)
	game = k // 2
	kol_b = kol_b + k * b + game
	m = m - k + game
print(kol_b, kol_p)


import math

def cal(n):
	result = 0
	while n > 1:
		t = pow(2, int(math.log2(n)))
		result += t - 1
		n = n - t + 1
	return result
(n, b, p) = map(int, input().split(' '))
print((2 * b + 1) * cal(n), n * p)


import collections
import math
(n, b, p) = map(int, input().split())
(ans, k, t) = (0, 2, n)
while k <= n:
	k *= 2
k //= 2
while n != 1:
	ans += (2 * b + 1) * (k // 2)
	n -= k // 2
	while k > n:
		k //= 2
print(ans, t * p)


import math
(n, a, b) = map(int, input().split())
c = 0
p = n
while n > 1:
	k = int(math.log(n, 2))
	c += k
	n -= k
print(c + c * 2 * a, p * b)


(n, botles, polot) = map(int, input().split())
b = (n - 1) * (2 * botles + 1)
p = n * polot
print(b, p, sep=' ')


import sys
(n, b, p) = input().split(' ')
itr_cnt = 0
n = int(n)
b = int(b)
p = int(p)
n_ = n
if n == 1:
	print('0', p)
	sys.exit()
directly = 0
div = 2
while n >= 2:
	directly += n % 2
	n = int(n / 2)
	itr_cnt += n
total_matches = itr_cnt + directly
bottles = total_matches * (2 * b) + total_matches
towels = n_ * p
print(bottles, towels)


def stuff(n, b, p):
	print((n - 1) * (b * 2 + 1), p * n)
(n, b, p) = input().strip().split()
stuff(int(n), int(b), int(p))


from math import log2
(n, b, p) = map(int, input().split())
k = 2 ** int(log2(n))
x = 0
y = p * n
while n > 1:
	x += (b * 2 + 1) * (k // 2)
	n = k // 2 + (n - k)
	k = 2 ** int(log2(n))
print(x, y)


(n, b, p) = map(int, input().split())
res = 0
a2 = n * p
while n != 1:
	step = 2
	while step * 2 <= n:
		step *= 2
	res += step * b + step // 2
	n -= step // 2
print(res, a2)


(n, b, p) = map(int, input().split())
garrafas = (n - 1) * (2 * b + 1)
toalhas = n * p
print(garrafas, toalhas)


(n, b, p) = map(int, input().split())
(x, y) = (0, n * p)
while n > 1:
	x += n // 2 * b * 2 + n // 2
	if n % 2 == 0:
		n //= 2
	else:
		n //= 2
		n += 1
print('{} {}'.format(x, y))


(n, b, p) = list(map(int, input().split(' ')))
dup = n
ans = 0
while n > 1:
	ans += n // 2 * (2 * b + 1)
	n = n // 2 + n % 2
print(ans, p * dup)


(n, b, p) = map(int, input().split())
m = 0
t = n
while n > 1:
	m += n // 2
	n = n // 2 + n % 2
bottles = (2 * b + 1) * m
tow = t * p
print(bottles, tow)


(n, b, p) = map(int, input().split())
if n < 3:
	if n == 2:
		print(2 * b + 1, 2 * p)
	elif n == 1:
		print(0, p)
else:
	q = n
	qs = 0
	while q != 1:
		s = 2
		e = 1
		while 2 * s < q:
			s *= 2
			e += 1
		q -= s // 2
		qs += s * b + s // 2
	print(int(qs), n * p)


import math
(n, b, p) = map(int, input().split())
curr = n
ans = 0
while curr != 1:
	l = 2 ** int(math.log(curr, 2))
	ans += l * b + l // 2
	curr -= l // 2
print(ans, n * p)


import math

def highestPowerOfTwo(n):
	p = int(math.log2(n))
	return int(math.pow(2, p))
(n, b, p) = map(int, input().split())
x = 0
y = p * n
while n > 1:
	k = highestPowerOfTwo(n)
	x += k * b + k // 2
	n -= k // 2
print(x, y)


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


def getBottlesAndTowels(n, b, p):
	return ((n - 1) * (2 * b + 1), n * p)
(n, b, p) = input().split()
(x, y) = getBottlesAndTowels(int(n), int(b), int(p))
print(x, y)


l = list(input().split())
(n, b, p) = (int(l[0]), int(l[1]), int(l[2]))
f = n
ans = 0
ans1 = 0
while n != 1:
	ans += n // 2 * 2 * b + n // 2 * 1
	x = n % 2
	n = n // 2 + x
print(ans, f * p)


(n, b, p) = map(int, input().split())
c = 0
k = n
while k > 1:
	i = 1
	while i * 2 <= k:
		i *= 2
	h = i // 2
	c += h + h * b * 2
	k = h + k - i
print(c, n * p)


import math
(n, b, p) = map(int, input().split())
b = 2 * b + 1
p = p * n
ans = 0
while n > 1:
	m = 2 ** int(math.log2(n)) // 2
	ans += b * m
	n -= m
print('%i %i ' % (ans, p))