Takahashi has come to an integer shop to buy an integer.
The shop sells the integers from 1 through 10^9. The integer N is sold for A \times N + B \times d(N) yen (the currency of Japan), where d(N) is the number of digits in the decimal notation of N.
Find the largest integer that Takahashi can buy when he has X yen. If no integer can be bought, print 0.

-----Constraints-----
 - All values in input are integers.
 - 1 \leq A \leq 10^9
 - 1 \leq B \leq 10^9
 - 1 \leq X \leq 10^{18}

-----Input-----
Input is given from Standard Input in the following format:
A B X

-----Output-----
Print the greatest integer that Takahashi can buy. If no integer can be bought, print 0.

-----Sample Input-----
10 7 100

-----Sample Output-----
9

The integer 9 is sold for 10 \times 9 + 7 \times 1 = 97 yen, and this is the greatest integer that can be bought.
Some of the other integers are sold for the following prices:
 - 10: 10 \times 10 + 7 \times 2 = 114 yen
 - 100: 10 \times 100 + 7 \times 3 = 1021 yen
 - 12345: 10 \times 12345 + 7 \times 5 = 123485 yen

Difficulty: EASY

Solutions:
import math
(A, B, X) = map(int, input().split())

def Price(N):
	d = math.floor(math.log10(N)) + 1
	return A * N + B * d
if Price(1) > X:
	Answer = 0
else:
	lef = 1
	rig = 10 ** 9
	for i in range(100):
		mid = (lef + rig) // 2
		if Price(mid) <= X:
			Answer = mid
			lef = mid
		else:
			rig = mid
	if Price(rig) <= X:
		Answer = rig
print(Answer)


def resolve():
	(a, b, x) = map(int, input().split())
	(l, r) = (0, 10 ** 9 + 1)
	while l < r - 1:
		m = l + (r - l) // 2
		p = a * m + b * len(str(m))
		if p > x:
			r = m
		else:
			l = m
	print(l)
resolve()


(a, b, x) = map(int, input().split())

def is_ok(arg):
	return a * arg + b * len(str(arg)) <= x

def meguru_bisect(ng, ok):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if is_ok(mid):
			ok = mid
		else:
			ng = mid
	return ok
print(meguru_bisect(10 ** 9 + 1, 0))


(A, B, X) = map(int, input().split(' '))

def cost(N):
	return A * N + B * len(str(N))
if cost(0) > X:
	print(0)
	return
if cost(10 ** 9) <= X:
	print(10 ** 9)
	return
bottom = 1
top = 10 ** 9
while top - bottom > 1:
	mid = (top + bottom) // 2
	if cost(mid) <= X:
		bottom = mid
	else:
		top = mid
print(bottom)


(A, B, X) = list(map(int, input().split()))
right = 10 ** 9
left = 0
while abs(right - left) > 1:
	N = (left + right) // 2
	cal = N * A + len(str(N)) * B
	if cal == X:
		ans = N
		print(ans)
		break
	elif cal < X:
		left = N
	else:
		right = N
else:
	if A * right + len(str(right)) * B <= X:
		print(right)
	else:
		print(left)


import math
(a, b, x) = map(int, input().split())
ok = 0
no = pow(10, 9) + 1
while no != ok + 1:
	center = math.floor((ok + no) / 2)
	digit = 1
	while center // pow(10, digit) != 0:
		digit += 1
	if x >= a * center + b * digit:
		ok = center
	elif x < a * center + b * digit:
		no = center
print(ok)


(A, B, X) = list(map(int, input().split()))
minimum = 0
maximum = 10 ** 9 + 1
while maximum - minimum > 1:
	medium = (maximum + minimum) // 2
	if A * medium + B * len(str(medium)) > X:
		maximum = medium
	else:
		minimum = medium
print(minimum)


import math
(a, b, x) = map(int, input().split())
maxv = 10 ** 9
minv = 1

def canbuy(n):
	tmp = a * n
	count = 0
	while n >= 1:
		n /= 10
		count += 1
	tmp += b * count
	return x >= tmp
if canbuy(1):
	midv = math.ceil((maxv + minv) / 2)
	while (maxv != midv) | (minv != midv):
		if canbuy(midv):
			minv = midv
		else:
			maxv = midv - 1
		midv = math.ceil((maxv + minv) / 2)
	print(midv)
else:
	print(0)


(A, B, X) = map(int, input().split())

def price(N):
	return A * N + B * len(str(N))
left = 0
right = 10 ** 9 + 1
while right - left > 1:
	mid = (left + right) // 2
	if price(mid) <= X:
		left = mid
	else:
		right = mid
print(left)


(a, b, x) = map(int, input().split())

def f(n):
	return x - (n * a + b * len(str(n)))

def test(n):
	if f(n) >= 0:
		return True
	else:
		return False
l = 0
r = 10 ** 9
flag = True
while flag:
	mid = (r + l) // 2
	if test(mid):
		l = mid
	else:
		r = mid
	if r - l <= 1:
		flag = False
		if test(r) and test(l):
			print(r)
		elif test(r) and test(l) != True:
			print(r)
		else:
			print(l)


(a, b, x) = [int(i) for i in input().split()]
left = 0
right = 10 ** 9 + 1
while right - left > 1:
	mid = (right + left) // 2
	if mid * a + b * len(str(mid)) > x:
		right = mid
	else:
		left = mid
print(left)


(A, B, X) = map(int, input().split())
ans = 0
for d in range(1, 19):
	if X - B * d <= 0:
		break
	N = min((X - B * d) // A, 10 ** d - 1)
	ans = max(ans, N)
print(min(ans, 10 ** 9))


(A, B, X) = map(int, input().split())
K = 0
while A * 10 ** K + B * K < X:
	K += 1
print(min((X - B * K) // A, 10 ** 9))


(A, B, X) = list(map(int, input().split()))

def func1(N):
	d = len(str(N))
	return A * N + B * d <= X
left = 0
right = 10 ** 30
while left + 1 < right:
	n = (left + right) // 2
	if func1(n):
		left = n
	else:
		right = n
ans = left
print(ans if ans < 10 ** 9 else 10 ** 9)


(a, b, x) = list(map(int, input().split()))
ans = 0

def binary_search(a, b, x):
	left = 1
	right = 10 ** 9
	while left <= right:
		mid = (left + right) // 2
		if x == a * mid + b * int(len(str(mid))):
			return mid
		elif x < a * mid + b * int(len(str(mid))):
			right = mid - 1
		else:
			left = mid + 1
	return right
print(binary_search(a, b, x))


(A, B, X) = map(int, input().split())
for i in range(1, 11):
	if A * 10 ** (i - 1) + B * i > X:
		i -= 1
		break
ans = (X - B * i) // A
if ans >= 10 ** 9:
	ans = 10 ** 9
if ans >= 10 ** i:
	ans = 10 ** i - 1
print(ans)


(A, B, X) = map(int, input().split())
Nmax = 10 ** 9
Nmin = 1
Nmid = (Nmax + Nmin) // 2

def nIsAffordable(a, b, n):
	lenOfN = len(str(n))
	price = a * n + b * lenOfN
	if price <= X:
		return True
	else:
		return False
if nIsAffordable(A, B, Nmax):
	print(Nmax)
else:
	while Nmax != Nmin:
		if nIsAffordable(A, B, Nmid):
			Nmin = Nmid + 1
			Nmid = (Nmax + Nmin) // 2
		else:
			Nmax = Nmid
			Nmid = (Nmax + Nmin) // 2
	print(Nmid - 1)


(A, B, X) = list(map(int, input().split()))
if A + B > X:
	print(0)
	return
t = 1
for i in range(1, 20):
	t *= 10
	if A * t + B * i > X:
		break

def is_ok(arg):
	a = len(str(arg))
	return A * arg + B * a <= X

def meguru_bisect(ok, ng):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if is_ok(mid):
			ok = mid
		else:
			ng = mid
	return ok
print(meguru_bisect(min(t // 10, 10 ** 8), min(t + 1, 10 ** 9 + 1)))


def main():
	(A, B, X) = list(map(int, input().split()))
	num_max = 10 ** 9
	digit_max = len(str(num_max))
	ans = 0
	for n in range(1, digit_max + 1):
		res = (X - B * n) // A
		if res > num_max:
			res = num_max
		if res < 0:
			continue
		digit = len(str(res))
		if digit == n:
			ans = max(ans, res)
		if digit > n:
			ans = max(ans, 10 ** n - 1)
	print(ans)

def __starting_point():
	main()
__starting_point()


def LI():
	return list(map(int, input().split()))
(A, B, X) = LI()
ans = 0
for i in range(1, 10):
	x = (X - B * i) // A
	L = len(str(x))
	xmin = int('1' + '0' * (i - 1))
	xminm = xmin * A + B * i
	xmax = int('9' * i)
	xmaxm = xmax * A + B * i
	if xminm > X:
		continue
	elif xmaxm <= X:
		ans = xmax
	elif x <= X:
		ans = x
x = 1000000000 * A + B * 10
if x <= X:
	ans = 1000000000
print(ans)


(A, B, X) = map(int, input().split())
if A * 10 ** 9 + B * 10 < X:
	print(10 ** 9)
elif A * 1 + B * 1 > X:
	print(0)
else:
	min_val = 1
	max_val = 10 ** 9
	tmp = (min_val + max_val) // 2
	prev_price = 0
	while 1:
		price = A * tmp + B * len(str(tmp))
		if price == prev_price:
			print(tmp)
			break
		if price < X:
			min_val = tmp
			tmp = (min_val + max_val) // 2
		elif price > X:
			max_val = tmp
			tmp = (min_val + max_val) // 2
		else:
			print(tmp)
			break
		prev_price = price


(a, b, x) = map(int, input().split())
max_ans = 10 ** 9
min_ans = 0

def j(ans):
	nonlocal a
	nonlocal b
	return a * ans + b * len(str(ans))
if j(1) > x:
	print(0)
	return
if j(max_ans) <= x:
	print(max_ans)
	return
ans = (max_ans + min_ans) // 2
for i in range(40):
	if j(ans) > x:
		max_ans = ans
	elif j(ans) < x:
		min_ans = ans
	else:
		print(ans)
		return
	ans = (max_ans + min_ans) // 2
print(ans)


(A, B, X) = list(map(int, input().split()))
(l, r) = (0, 10 ** 9 + 1)
while r - l > 1:
	m = (l + r) // 2
	if A * m + B * len(str(m)) > X:
		r = m
	else:
		l = m
print(l)


import sys
from math import ceil
(A, B, X) = list(map(int, input().split()))

def calc(N, L_N):
	return A * N + B * L_N
l = 0
r = 10 ** 9 + 1
while r - l > 1:
	c = (r + l) // 2
	if calc(c, len(str(c))) <= X:
		l = c
	else:
		r = c
print(l)


(A, B, X) = list(map(int, input().split()))
left = 0
right = 1000000001
while right - left > 1:
	mid = (left + right) // 2
	if A * mid + B * len(str(mid)) > X:
		right = mid
	else:
		left = mid
print(left)


import sys
import math
from collections import defaultdict, deque, Counter
from copy import deepcopy
from bisect import bisect, bisect_right, bisect_left
from heapq import heapify, heappop, heappush
input = sys.stdin.readline

def RD():
	return input().rstrip()

def F():
	return float(input().rstrip())

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

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

def MF():
	return map(float, input().split())

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

def TI():
	return tuple(map(int, input().split()))

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

def Init(H, W, num):
	return [[num for i in range(W)] for j in range(H)]

def main():
	(A, B, X) = MI()
	keta = 0
	while True:
		temp = A * pow(10, keta) + B * (keta + 1)
		if temp > X:
			break
		keta += 1
	keta -= 1
	if A + B > X:
		print(0)
		return
	ans = (X - B * (keta + 1)) // A
	if len(str(ans)) > keta + 1:
		ans = int('9' * (keta + 1))
	if ans >= 1000000000:
		print(1000000000)
	else:
		print(ans)

def __starting_point():
	main()
__starting_point()


(A, B, X) = list(map(int, input().split()))

def d(N):
	return len(str(N))

def price(N):
	return A * N + B * d(N)

def bisec(low, high):
	if low == high:
		return high
	elif low + 1 == high:
		if price(high) == X:
			return high
		else:
			return low
	else:
		n = (low + high) // 2
		if price(n) > X:
			return bisec(low, n)
		elif price(n) < X:
			return bisec(n, high)
		else:
			return n
if price(1) > X:
	print(0)
elif price(10 ** 9) <= X:
	print(10 ** 9)
else:
	print(bisec(1, 10 ** 9))


(A, B, X) = map(int, input().split())

def nibutan(a, b, x):
	left_index = 1
	right_index = 10 ** 9
	while left_index <= right_index:
		cc = (left_index + right_index) // 2
		if x - a * cc - b * len(str(cc)) > 0:
			left_index = cc + 1
		elif x - a * cc - b * len(str(cc)) == 0:
			return cc
		else:
			right_index = cc - 1
	return right_index
print(nibutan(A, B, X))


def main():
	(A, B, X) = list(map(int, input().split()))
	num_max = 10 ** 9
	ok = 0
	ng = num_max + 1
	while abs(ng - ok) > 1:
		mid = (ng + ok) // 2
		res = A * mid + B * len(str(mid))
		if res <= X:
			ok = mid
		else:
			ng = mid
	print(ok)

def __starting_point():
	main()
__starting_point()


(a, b, x) = map(int, input().split())
ok = 0
ng = pow(10, 9) + 1
while abs(ng - ok) > 1:
	mid = int((ok + ng) / 2)
	c = a * mid + b * len(str(mid))
	if c <= x:
		ok = mid
	else:
		ng = mid
print(ok)


(A, B, X) = map(int, input().split())
N = 10 ** 9
(low, high) = (0, N + 1)
while low + 1 < high:
	mid = (low + high) // 2
	if A * mid + B * len(str(mid)) <= X:
		low = mid
	else:
		high = mid
print(low)


(A, B, X) = map(int, input().split())
s = 1
e = 1000000000

def price(x):
	return x * A + len(str(x)) * B
if price(s) > X:
	print(0)
	return
if price(e) <= X:
	print(e)
	return
while e > s + 1:
	tmp = (s + e) // 2
	if price(tmp) <= X:
		s = tmp
	else:
		e = tmp
print(s)


(a, b, x) = list(map(int, input().split()))
ans = 0
for i in range(11):
	nokori = max(0, x - b * i)
	ans = max(ans, min(10 ** i - 1, nokori // a))
print(min(10 ** 9, ans))


def main():
	(A, B, X) = list(map(int, input().split()))
	num_max = 10 ** 9
	right = num_max + 1
	ok_max = 0
	cnt = 0
	while right - ok_max > 1:
		mid = (right + ok_max) // 2
		res = A * mid + B * len(str(mid))
		if res <= X:
			ok_max = mid
		else:
			right = mid
		cnt += 1
	print(ok_max)

def __starting_point():
	main()
__starting_point()


import math

def solve(A: int, B: int, X: int):
	left = 1
	right = 10 ** 9
	if A + B > X:
		return 0
	if A * right + B * len(str(right)) <= X:
		return right
	while left + 1 < right:
		mid = (left + right) // 2
		if A * mid + B * len(str(mid)) <= X:
			left = mid
		else:
			right = mid
	return left

def main():
	(A, B, X) = list(map(int, input().split()))
	ans = solve(A, B, X)
	print(ans)

def __starting_point():
	main()
__starting_point()


(A, B, X) = [int(_) for _ in input().split()]

def d(N):
	return len(str(N))
ok_max = 0
ng_min = 10 ** 9 + 1
while ng_min - ok_max > 1:
	n = (ok_max + ng_min) // 2
	if A * n + B * d(n) <= X:
		ok_max = n
	else:
		ng_min = n
print(ok_max)


(A, B, X) = map(int, input().split())
if A + B > X:
	print(0)
else:
	f = 0
	while f <= 9:
		S = A * 10 ** f + B * (f + 1)
		if S > X:
			break
		f += 1
	if f == 10:
		print(10 ** 9)
	else:
		X = X - B * f
		print(min(X // A, 10 ** f - 1))


(A, B, X) = list(map(int, input().split()))
good = 0
bad = 10 ** 9 + 1
while bad - good > 1:
	mid = (bad + good) // 2
	if A * mid + B * len(str(mid)) <= X:
		good = mid
	else:
		bad = mid
print(good)


(a, b, x) = map(int, input().split())
arr = [0]
if x >= a * 10 ** 9 + b * 10:
	print(10 ** 9)
	return
elif x < a + b:
	print(0)
	return
else:
	for i in range(1, 10):
		n = (x - b * i) // a
		if len(str(n)) > i:
			arr.append(10 ** i - 1)
		else:
			arr.append(n)
	print(max(arr))


(a, b, x) = list(map(int, input().split()))

def c(n):
	d = len(str(n))
	return a * n + b * d <= x
(s, t) = (0, 10 ** 9 + 1)
while s + 1 < t:
	mid = (s + t) // 2
	if c(mid):
		s = mid
	else:
		t = mid
print(s)


(a, b, x) = map(int, input().split())
mx = 10 ** 9 + 1
mn = 0
while mx - mn > 1:
	mid = (mx + mn) // 2
	p = a * mid + b * len(str(mid))
	if p <= x:
		mn = mid
	else:
		mx = mid
print(mn)


import math
(A, B, X) = map(int, input().split())
a = 10 ** 9 + 1
b = X

def is_ok(arg):
	return A * arg + B * int(math.log10(arg) + 1) <= b

def bisect(ng, ok):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if is_ok(mid):
			ok = mid
		else:
			ng = mid
	return ok
print(bisect(a, 0))


from math import log10, floor
(a, b, x) = map(int, input().split())
(n, m) = (0, 0)
for i in range(10):
	if a * 10 ** i + b * (i + 1) <= x:
		n = 10 ** i
		m = i + 1
if n == 0:
	print(0)
else:
	print(min(10 ** 9, 10 * n - 1, n + (x - a * n - b * m) // a))


def solve(x):
	return A * x + B * len(str(x)) <= X

def binary_search(ok, ng):
	while abs(ok - ng) > 1:
		middle = (ok + ng) // 2
		if solve(middle):
			ok = middle
		else:
			ng = middle
	return ok
(A, B, X) = map(int, input().split())
ans = binary_search(0, 10 ** 9 + 1)
print(ans)


(A, B, X) = map(int, input().split())

def isPurchasable(x):
	cost = A * x + B * len(str(x))
	return cost <= X
if not isPurchasable(1):
	print(0)
	return
if isPurchasable(10 ** 9):
	print(10 ** 9)
	return
ok = 1
ng = 10 ** 9
while abs(ng - ok) > 1:
	number = (ok + ng) // 2
	if isPurchasable(number):
		ok = number
	else:
		ng = number
ans = ok
print(ans)


(a, b, x) = list(map(int, input().split()))
(l, r) = (0, 10 ** 9 + 1)
while l + 1 < r:
	n = (l + r) // 2
	if a * n + b * len(str(n)) > x:
		r = n
	else:
		l = n
print(l)


from collections import defaultdict, Counter
from itertools import product, groupby, count, permutations, combinations
from math import pi, sqrt
from collections import deque
from bisect import bisect, bisect_left, bisect_right
from string import ascii_lowercase
from functools import lru_cache
import sys
sys.setrecursionlimit(10000)
INF = float('inf')
(YES, Yes, yes, NO, No, no) = ('YES', 'Yes', 'yes', 'NO', 'No', 'no')
(dy4, dx4) = ([0, 1, 0, -1], [1, 0, -1, 0])
(dy8, dx8) = ([0, -1, 0, 1, 1, -1, -1, 1], [1, 0, -1, 0, 1, 1, -1, -1])

def inside(y, x, H, W):
	return 0 <= y < H and 0 <= x < W

def ceil(a, b):
	return (a + b - 1) // b

def sum_of_arithmetic_progression(s, d, n):
	return n * (2 * s + (n - 1) * d) // 2

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

def lcm(a, b):
	g = gcd(a, b)
	return a / g * b

def solve():
	(A, B, X) = list(map(int, input().split()))
	(low, high) = (-1, 10 ** 10)
	while high - low > 1:
		middle = (low + high) // 2
		need = A * middle + B * len(str(middle))
		if need <= X:
			low = middle
		else:
			high = middle
	low = min(max(0, low), 10 ** 9)
	print(low)

def main():
	solve()

def __starting_point():
	main()
__starting_point()


(a, b, x) = map(int, input().split())
(l, r) = (0, 10 ** 9 + 1)
while r - l > 1:
	t = (l + r) // 2
	(r, l) = [[r, t], [t, l]][a * t + b * len(str(t)) > x]
print(l)


(A, B, X) = map(int, input().split())
if A + B > X:
	print(0)
	return
a = 0
b = 10 ** 9 + 1
while a + 1 < b:
	m = (a + b) // 2
	if A * m + B * len(str(m)) == X:
		print(m)
		return
	if A * m + B * len(str(m)) > X:
		b = m
	if A * m + B * len(str(m)) < X:
		a = m
print(a)


(A, B, X) = map(int, input().split())

def judge(x):
	if A * x + B * len(str(x)) <= X:
		return True
	else:
		return False
sta = 0
fin = X
while fin - sta > 1:
	m = (fin + sta) // 2
	if judge(m) == True:
		sta = m
	else:
		fin = m
if sta > 10 ** 9:
	print(10 ** 9)
else:
	print(sta)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
stdin = sys.stdin
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
(A, B, X) = na()

def judge(N, A, B, X):
	dn = len(str(N))
	if A * N + B * dn <= X:
		return True
	else:
		return False

def binary_search(A, B, X):
	left = 0
	right = 10 ** 9
	while right - left > 1:
		mid = left + (right - left) // 2
		if judge(mid, A, B, X):
			left = mid
		else:
			right = mid
	return left
if judge(10 ** 9, A, B, X):
	print(10 ** 9)
else:
	print(binary_search(A, B, X))


(A, B, X) = list(map(int, input().split()))

def digit(x):
	strx = str(x)
	return len(strx)

def calc_value(x):
	return A * x + B * digit(x)

def binary_search(num_max):
	if num_max <= 0:
		return 0
	left = 0
	right = num_max
	while left <= right:
		mid = (left + right) // 2
		mid_value = calc_value(mid)
		if mid_value == X:
			return mid
		elif mid_value < X:
			left = mid + 1
		else:
			right = mid - 1
	return left - 1
store = 10 ** 9
if X >= calc_value(store):
	ans = store
else:
	ans = binary_search(X // A)
	ans = min(10 ** 9, ans)
print(ans)


(A, B, X) = map(int, input().split())
N = 0
dN = len(str(N))
p = A * N + B * dN
for i in range(N, 10 ** 9, 10000000):
	N += 10000000
	dN = len(str(N))
	p = A * N + B * dN
	if p > X:
		N -= 10000000
		break
for j in range(N, 10 ** 9, 10000):
	N += 10000
	dN = len(str(N))
	p = A * N + B * dN
	if p > X:
		N -= 10000
		break
for k in range(N, 10 ** 9):
	N += 1
	dN = len(str(N))
	p = A * N + B * dN
	if p > X:
		N -= 1
		break
if N > 10 ** 9:
	print(10 ** 9)
else:
	print(N)


(A, B, X) = list(map(int, input().split()))
ans = 0
if A * 1000000000 + B * 10 <= X:
	ans = 1000000000
for d in range(1, 10):
	x = (X - B * d) // A
	if 10 ** (d - 1) <= x and x < 10 ** d:
		ans = max(ans, x)
	elif x >= 10 ** d:
		ans = max(ans, 10 ** d - 1)
print(ans)


(a, b, x) = map(int, input().split())
(minNumber, maxNumber) = (0, 10 ** 9 + 1)
answer = 0
while minNumber + 1 < maxNumber:
	n = (minNumber + maxNumber) // 2
	if a * n + b * len(str(n)) > x:
		maxNumber = n
	else:
		minNumber = n
print(minNumber)


(A, B, X) = map(int, input().split())
ans = 0

def cost(A, B, N):
	return A * N + B * len(str(N))
head = 0
tail = 10 ** 9 + 1
while head <= tail:
	center = (head + tail) // 2
	if tail - head <= 10:
		tem = head
		break
	elif cost(A, B, center) < X:
		head = center + 1
	elif cost(A, B, center) > X:
		tail = center - 1
for N in range(max(0, tem - 10), min(tem + 10, 10 ** 9 + 1)):
	if cost(A, B, N) <= X:
		ans = N
print(ans)


from decimal import *
(a, b, x) = list(map(int, input().split()))
ans = 0
d = 0
for i in range(10, 0, -1):
	left = x - b * i
	if left >= a * pow(10, i - 1):
		d = i
		break
if d == 0:
	print(0)
elif d == 10:
	print(10 ** 9)
else:
	left = x - b * d
	left = Decimal(left) / Decimal(a)
	ans = int(left)
	if ans >= pow(10, d):
		ans = pow(10, d) - 1
	print(ans)


(a, b, x) = map(int, input().split())
low = 0
high = 10 ** 9
if a * 10 ** 9 + b * 10 <= x:
	print(high)
else:
	while high - low > 1:
		n = (low + high) // 2
		if a * n + b * len(str(n)) <= x:
			low = n
		else:
			high = n
	print(low)


(A, B, X) = map(int, input().split())
D = min(10, X // B)
flag = 1
while X - B * D > 0:
	N = (X - B * D) // A
	if N >= 10 ** (D - 1):
		N = min(N, 10 ** D - 1)
		break
	if D < 1:
		flag = 0
		break
	D -= 1
if N > 10 ** 9:
	N = 10 ** 9
print(N if flag else flag)


(a, b, x) = map(int, input().split())
upper = 10 ** 9 + 1
bottom = 0
while upper - bottom > 1:
	middle = (upper + bottom) // 2
	if a * middle + b * len(str(middle)) <= x:
		bottom = middle
	else:
		upper = middle
print(bottom)


import sys
input = sys.stdin.readline
(a, b, x) = map(int, input().split())
max_number = 10 ** 9 + 1
min_number = 0

def is_ok(n):
	money = a * n + b * len(str(n))
	if money <= x:
		return True
	else:
		return False

def meguru_bisect(ng, ok):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if is_ok(mid):
			ok = mid
		else:
			ng = mid
	return ok
ans = meguru_bisect(max_number, min_number)
print(ans)


(a, b, x) = map(int, input().split())
lo = 1
hi = 10 ** 9
idx = 0
while lo <= hi:
	idx = (lo + hi) // 2
	m = a * idx + b * len(str(idx))
	if m == x:
		hi = idx
		break
	elif m > x:
		hi = idx - 1
	else:
		lo = idx + 1
print(hi)


import math, string, itertools, fractions, heapq, collections, re, array, bisect, sys, random, time, copy
sys.setrecursionlimit(10 ** 7)
inf = 10 ** 20
mod = 10 ** 9 + 7
stdin = sys.stdin
ni = lambda : int(ns())
na = lambda : list(map(int, stdin.readline().split()))
ns = lambda : stdin.readline().rstrip()
(A, B, X) = na()
ans = 0
for dn in range(18 + 1):
	s = X - dn * B
	tmp = s // A
	N = min(tmp, 10 ** 9)
	if len(str(N)) == dn:
		ans = max(ans, N)
	else:
		t = 10 ** dn - 1
		if N >= t:
			ans = max(ans, t)
print(min(ans, 10 ** 9))


def is_ok(arg, a, b, x):
	return True if a * arg + b * len(str(arg)) <= x else False

def meguru_bisect(ok, ng, a, b, x):
	while abs(ok - ng) > 1:
		mid = (ok + ng) // 2
		if is_ok(mid, a, b, x):
			ok = mid
		else:
			ng = mid
	return ok

def main():
	(a, b, x) = list(map(int, input().split()))
	ans = meguru_bisect(0, 10 ** 9 + 1, a, b, x)
	print(ans)

def __starting_point():
	main()
__starting_point()


import math

def calcMaxNum(minCandidate: int, maxCandidate: int, A, B, X):
	if A == 0 and B == 0:
		print(10 ** 9)
		return
	if maxCandidate >= 10 ** 9:
		maxCandidate = 10 ** 9
	if minCandidate > 10 ** 9:
		minCandidate = 10 ** 9
	if minCandidate < 1:
		minCandidate = 1
	currentMax = 0
	for i in range(minCandidate, maxCandidate + 1):
		amount = A * i + B * len(str(i))
		if X > amount:
			currentMax = i
		elif X == amount:
			print(i)
			return
		else:
			print(currentMax)
			return
	print(currentMax)
	return
INPUT = list(map(int, input().split()))
A = INPUT[0]
B = INPUT[1]
X = INPUT[2]
maxCandidate = 10 ** 9
minCandidate = 0
if A != 0:
	maxCandidate = math.ceil(X / A)
	minCandidate = math.floor((X - 9 * B) / A) - 1
else:
	minCandidate = X - 9 * B - 1
calcMaxNum(minCandidate, maxCandidate, A, B, X)


(A, B, X) = map(int, input().split())
(left, right) = (0, int(X / A))
while right - left > 1:
	mid = int((left + right) / 2)
	if mid * A + len(str(mid)) * B <= X:
		left = mid
	else:
		right = mid
if left <= X:
	if left >= 10 ** 9:
		print(10 ** 9)
	else:
		print(left)
else:
	print(0)


(a, b, x) = map(int, input().split())
ls = []
for i in range(1, 10):
	(l, r) = (10 ** (i - 1), 10 ** i - 1)
	y = (x - b * i) // a
	for _ in range(10000):
		m = (l + r) / 2
		if y == m:
			break
		elif y < m:
			r = m
		else:
			l = m
	m = round(m)
	for n in [m - 1, m, m + 1]:
		if a * n + b * len(str(n)) <= x:
			ls.append(n)
print(max(ls) if ls else 0)


import sys
input = sys.stdin.readline
(a, b, x) = map(int, input().split())
if a * 10 ** 9 + b * 10 < x:
	print(10 ** 9)
	return

def bisearch(n):
	left = 1
	right = 10 ** 9
	maxbuy = 0
	while left <= right:
		mid = (left + right) // 2
		now = a * mid + b * len(str(mid))
		if now <= x and now > maxbuy:
			maxbuy = mid
		if now > x:
			right = mid - 1
		else:
			left = mid + 1
	return maxbuy
print(bisearch(x))


def buy_an_integer(a, b, x, l, r):
	c = (l + r) // 2
	price = a * c + b * len(str(c))
	if price > x:
		if c == r:
			return c
		return buy_an_integer(a, b, x, l, c)
	else:
		if c == l:
			return c
		return buy_an_integer(a, b, x, c, r)

def main():
	(a, b, x) = list(map(int, input().strip().split()))
	if a + b > x:
		return 0
	if a * 10 ** 9 + b * 10 < x:
		return 10 ** 9
	return buy_an_integer(a, b, x, 0, 10 ** 9)
print(main())


(A, B, X) = map(int, input().split())

def d(n):
	return len(str(n))
N = 10 ** 9 + 1
up = N
down = 0
while True:
	mid = (down + up) // 2
	if mid == down:
		break
	if X < A * mid + B * d(mid):
		up = mid
	else:
		down = mid
print(down)


(A, B, X) = map(int, input().split())

def test(N):
	L = len(str(N))
	return A * N + B * L <= X
left = 0
right = 10 ** 30
while left + 1 < right:
	x = (left + right) // 2
	if test(x):
		left = x
	else:
		right = x
ans = left
if ans >= 10 ** 9:
	ans = 10 ** 9
print(ans)


(a, b, x) = map(int, input().split())
i = 1
low = 0
high = 10 ** 9 + 1
while low <= high and i <= 100:
	mid = (low + high) // 2
	if a * mid + b * len(str(mid)) > x:
		high = mid
	else:
		low = mid
	i += 1
print(low)


(A, B, X) = map(int, input().split())
ans = 0
for i in range(1, 11):
	N = min(int(str(9) * i), (X - B * i) // A)
	ans = max(N, ans)
ans = min(10 ** 9, ans)
print(ans)


(A, B, X) = map(int, input().split())
L = 0
R = 1000000000
while R - L > 1:
	M = (L + R) // 2
	P = A * M + B * len(str(M))
	if P <= X:
		L = M
	else:
		R = M - 1
if R == L:
	print(L)
elif A * R + B * len(str(R)) <= X:
	print(R)
else:
	print(L)


import math
(a, b, x) = list(map(int, input().split()))
m = 1
if a + b > x:
	print(0)
else:
	while a * 10 ** (m - 1) + b * m <= x:
		m += 1
	m = m - 1
	if m >= 10:
		print(10 ** 9)
	else:
		print(min((x - b * m) // a, 10 ** m - 1))


(a, b, x) = map(int, input().split())
(max_val, min_val) = (10 ** 9 + 1, 0)
while max_val - min_val > 1:
	mid_val = (max_val + min_val) // 2
	c = a * mid_val + b * len(str(mid_val))
	if c <= x:
		min_val = mid_val
	else:
		max_val = mid_val
print(min_val)


(A, B, X) = list(map(int, input().split()))
ok = 0
ng = 10 ** 9 + 1
while abs(ok - ng) > 1:
	N = (ok + ng) // 2
	digit = len(str(N))
	if A * N + B * digit <= X:
		ok = N
	else:
		ng = N
print(ok)