Let us call a pair of integer numbers m-perfect, if at least one number in the pair is greater than or equal to m. Thus, the pairs (3, 3) and (0, 2) are 2-perfect while the pair (-1, 1) is not.

Two integers x, y are written on the blackboard. It is allowed to erase one of them and replace it with the sum of the numbers, (x + y).

What is the minimum number of such operations one has to perform in order to make the given pair of integers m-perfect?


-----Input-----

Single line of the input contains three integers x, y and m ( - 10^18 ≤ x, y, m ≤ 10^18).

Please, do not use the %lld specifier to read or write 64-bit integers in C++. It is preffered to use the cin, cout streams or the %I64d specifier.


-----Output-----

Print the minimum number of operations or "-1" (without quotes), if it is impossible to transform the given pair to the m-perfect one.


-----Examples-----
Input
1 2 5

Output
2

Input
-1 4 15

Output
4

Input
0 -1 5

Output
-1



-----Note-----

In the first sample the following sequence of operations is suitable: (1, 2) $\rightarrow$ (3, 2) $\rightarrow$ (5, 2).

In the second sample: (-1, 4) $\rightarrow$ (3, 4) $\rightarrow$ (7, 4) $\rightarrow$ (11, 4) $\rightarrow$ (15, 4).

Finally, in the third sample x, y cannot be made positive, hence there is no proper sequence of operations.

Source: codeforces | Difficulty: MEDIUM_HARD
Tags: Complete search


Solutions:
(x, y, m) = map(int, input().split())
(x, y) = (min(x, y), max(x, y))
if y >= m:
	print(0)
elif y <= 0:
	print(-1)
else:
	c = 0
	while y < m:
		q = (2 * y - x) // y
		c += q
		(x, y) = (y, x + q * y)
	print(c)


(x, y, m) = map(int, input().split())
i = 0
if x >= m or y >= m:
	print(i)
elif max(x, y) <= 0:
	print(-1)
else:
	if x > y:
		(x, y) = (y, x)
	if x < 0:
		i = (y - x) // y
		x += i * y
	while y < m:
		(x, y) = (y, x + y)
		i += 1
	print(i)


def solve(x, y, m):
	res = 0
	while max(x, y) < m:
		(x, y) = (x + y, y)
		res += 1
		if max(x, y) >= m:
			return res
		(x, y) = (x, x + y)
		res += 1
	return res

def main():
	(x, y, m) = map(int, input().split())
	if max(x, y) >= m:
		print(0)
		return
	if x <= 0 and y <= 0:
		print(-1)
		return
	if x <= 0:
		(x, y) = (y, x)
	cnt = 0
	if y < 0:
		cnt = (abs(y) + x - 1) // x
		y += cnt * x
	cnt += min(solve(x, y, m), solve(y, x, m))
	print(cnt)
main()


s = input().split()
(x, y, m) = (int(i) for i in s)
ans = 0
if x >= m or y >= m:
	print(0)
elif x <= 0 and y <= 0:
	print(-1)
else:
	if x < 0:
		q = abs(x // y)
		ans += q
		x += y * q
	elif y < 0:
		q = abs(y // x)
		ans += q
		y += x * q
	while x < m and y < m:
		ans += 1
		if x < y:
			x = x + y
		else:
			y = x + y
	print(ans)


def main():
	(x, y, m) = map(int, input().split())
	b1 = min(x, y)
	b2 = max(x, y)
	count = 0
	if b2 >= m:
		return 0
	if b2 <= 0:
		return -1
	if b1 < 0:
		count = (b2 - b1 + (b2 - 1)) // b2
		b = b2
		b2 = b1 + count * b2
		b1 = b
	while b2 < m:
		b = b1 + b2
		b1 = min(b2, b)
		b2 = max(b2, b)
		count += 1
	return count
print('{:#d}'.format(main()))


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


(x, y, m) = map(int, input().split())
num = 0
if m > max(x, y):
	if x + y > 0:
		while m > x + y:
			if x > y:
				y = x + y
			else:
				x = x + y
			num += 1
		print(num + 1)
	elif x + y > min(x, y):
		if x > y:
			num += abs(y // x) + 1
			y = y % x
		else:
			num += abs(x // y) + 1
			x = x % y
		while m > x + y:
			if x > y:
				y = x + y
			else:
				x = x + y
			num += 1
		print(num)
	else:
		print(-1)
else:
	print(0)


def ag():
	(a, b, m) = map(int, input().split())
	x = min(a, b)
	y = max(a, b)
	res = 0
	if x >= m or y >= m:
		return 0
	elif y <= 0:
		return '-1'
	if x < 0:
		res += int((abs(x) + y - 1) / y)
		x += y * res
	while y < m:
		x1 = y
		y = y + x
		x = x1
		res += 1
	return res
print(ag())


(x, y, n) = map(int, input().split())
res = 0
if max(x, y) >= n:
	print(0)
elif x + y < n and x <= 0 and (y <= 0):
	if max(x, y) < n:
		print(-1)
	else:
		print(0)
else:
	if x * y < 0:
		(x, y) = (min(x, y), max(x, y))
		if y >= n:
			print(0)
		else:
			res += -x // y
			x += y * res
	while max(x, y) < n:
		(x, y) = (max(x, y), x + y)
		res += 1
	print(res)


(x, y, xx) = map(int, input().split())
cnt = 0
while max(x, y) < xx:
	if x < y:
		(x, y) = (y, x)
	(l, r, m) = (0, 4 * 10 ** 18, 0)
	while r > l + 1:
		m = (l + r) // 2
		if x >= m * x + y:
			l = m
		else:
			r = m
	if r == 4e+18:
		print(-1)
		return
	cnt += r
	temp = x
	x = r * x + y
	y = temp
print(cnt)


(x, y, m) = map(int, input().split())
if max(x, y) >= m:
	print(0)
elif x <= 0 and y <= 0:
	print(-1)
else:
	if x > y:
		(x, y) = (y, x)
	(ans, st) = (0, 0)
	add = 0
	if x <= 0:
		st = (0 - x + y - 1) // y
		x += y * st
	ans = st + (m - x + y - 1) // y
	while y < m:
		(x, y) = (y, x + y)
		add += 1
		ans = min(ans, add + st + (m - x + y - 1) // y)
	ans = min(ans, add + st)
	print(ans)


(x, y, m) = map(int, input().split())
if x > y:
	(x, y) = (y, x)
if y >= m:
	print(0)
	exit(0)
if y <= 0:
	print(-1)
	exit()
anw = 0
if x < 0:
	anw += abs(x) // y
	x += abs(x) // y * y
while max(x, y) < m:
	if x > y:
		(x, y) = (y, x)
	x = y + x
	anw += 1
print(anw)


import sys
import os
import math
import copy
from math import gcd
from bisect import bisect
from io import BytesIO, IOBase
from math import sqrt, floor, factorial, gcd, log, ceil
from collections import deque, Counter, defaultdict
from itertools import permutations, combinations

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

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

def Lstr():
	return list(sys.stdin.readline().strip())

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

def Mstr():
	return map(str, sys.stdin.readline().strip().split())

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

def Hash():
	return dict()

def Mod():
	return 1000000007

def Ncr(n, r, p):
	return fact[n] * (ifact[r] * ifact[n - r] % p) % p

def Most_frequent(list):
	return max(set(list), key=list.count)

def Mat2x2(n):
	return [List() for _ in range(n)]

def btod(n):
	return int(n, 2)

def dtob(n):
	return bin(n).replace('0b', '')

def solution():
	(x, y, m) = Mint()
	ans = 0
	if x >= m or y >= m:
		print(0)
	elif x <= 0 and y <= 0:
		print(-1)
	else:
		if x > 0 and y < 0:
			ans = (x - y - 1) // x
			y += ans * x
		elif y > 0 and x < 0:
			ans = (y - x - 1) // y
			x += ans * y
		while x < m and y < m:
			t = x + y
			if x < y:
				x = t
			else:
				y = t
			ans += 1
		print(ans)
solution()


(x, y, m) = map(int, input().split())
if x <= 0 and y <= 0 and (x < m) and (y < m):
	print(-1)
	exit()
if x > m or y > m:
	print(0)
	exit()
cnt = 0
if x < 0 and y > 0:
	l = -x // y
	x += l * y
	cnt += l
elif x > 0 and y < 0:
	l = -y // x
	y += l * x
	cnt += l
while x < m and y < m:
	if x < y:
		x += y
	else:
		y += x
	cnt += 1
print(cnt)


import math
(a, b, c) = map(int, input().split())
if max(a, b) >= c:
	print(0)
	raise SystemExit
if a <= 0 and b <= 0:
	print(-1)
	raise SystemExit
tot = 0
if a <= 0 and b > 0 or (b <= 0 and a > 0):
	add = max(a, b)
	menor = min(a, b)
	adicionar = math.ceil(-menor / add)
	tot = adicionar
	if min(a, b) == a:
		a += add * adicionar
	else:
		b += add * adicionar
times = 500
while times > 0:
	times -= 1
	if max(a, b) >= c:
		print(tot)
		raise SystemExit
	tot += 1
	add = a + b
	if min(a, b) == a:
		a = add
	else:
		b = add
print(-1)


(x, y, m) = list(map(int, input().split()))
if x > y:
	(x, y) = (y, x)
if y >= m:
	print('0')
elif x + y <= x:
	print('-1')
else:
	ans = (y - x + y - 1) // y
	x += y * ans
	while x < m:
		(x, y) = (x + y, x)
		ans += 1
	print(ans)


(x, y, m) = map(int, input().split())
if max(x, y) >= m:
	print(0)
elif m < 0 or max(x, y) <= 0:
	print(-1)
else:
	if x + y < 0:
		cnt = (max(x, y) - min(x, y)) // max(x, y)
		(x, y) = (min(x, y) + max(x, y) * cnt, max(x, y))
	else:
		cnt = 0
	while max(x, y) < m:
		(x, y) = (max(x, y), x + y)
		cnt += 1
	print(cnt)


(x, y, m) = (int(q) for q in input().split())
if x >= m or y >= m:
	print(0)
	return
if x <= 0 and y <= 0:
	print(-1)
	return
ans = 0
if x < 0:
	ans += -x // y
	x += -x // y * y
if y < 0:
	ans += -y // x
	y += -y // x * x
while x < m and y < m:
	ans += 1
	if x < y:
		x += y
	else:
		y += x
print(ans)


from sys import stdin
__author__ = 'artyom'

def read_next_line():
	return list(map(int, stdin.readline().strip().split()))
(x, y, m) = read_next_line()
a = [x, y]
x = min(a)
y = max(a)
if y <= 0 and m > y:
	print(-1)
else:
	count = 0
	if x < 0 and m > y:
		count = -(x // y)
		x = x % y
	while m > y:
		tmp = y
		y = x + y
		x = tmp
		count += 1
	print(count)


(x, y, m) = map(int, input().split())
if x >= m or y >= m:
	print(0)
elif x <= 0 and y <= 0 and (m >= 0):
	print(-1)
elif x < 0 and y < 0 and (m < 0) and (abs(x) > abs(m)) and (abs(y) > abs(m)):
	print(-1)
else:
	if x > y:
		(x, y) = (y, x)
	count = 0
	if x < 0:
		div = abs(x) // y
		if x + div * y >= 0:
			count = div
		else:
			count = div + 1
			div += 1
		x = x + div * y
	i = 0
	while True:
		z = x + y
		if x < y:
			x = y
		y = z
		i += 1
		if z >= m:
			break
	print(i + count)


import math
(a, b, c) = map(int, input().split())
count = 0
if a < b:
	(a, b) = (b, a)
if a >= c:
	print(0)
else:
	if a > 0 and b < 0:
		count = math.ceil(abs(b) / a)
		b += a * count
	c2 = 0
	while max(a, b) < c:
		if a < b:
			a = a + b
		else:
			b = a + b
		c2 += 1
		if c2 > 10 ** 6:
			c2 = -1
			break
	print(count + c2)


(x, y, m) = map(int, input().split())
(a, b) = (max(x, y), min(x, y))
if a >= m:
	print(0)
	exit()
if a <= 0:
	print(-1)
	exit()
res = 0
if b < 0:
	res += -b // a
	b += res * a
if a < b:
	(a, b) = (b, a)
while a < m:
	b += a
	res += 1
	if a < b:
		(a, b) = (b, a)
print(res)


(x, y, m) = map(int, input().split())
a = max(x, y)
if a <= 0 and m > a:
	print(-1)
else:
	b = max(x, y)
	a = min(x, y)
	a1 = a
	b1 = b
	if b >= m:
		print(0)
		exit()
	ans = abs(b - a) // b
	a += b * ans
	ans1 = 100000000000000000000
	while max(a, b) < m:
		if a <= b:
			a = a + b
		else:
			b = a + b
		ans += 1
	if a1 > 0:
		ans1 = (m - b1) // a1
		if (m - b1) % a1:
			ans1 += 1
	ans = min(ans, ans1)
	print(ans)


import math
(x, y, m) = map(int, input().split())
if x >= m or y >= m:
	print(0)
elif x > 0 or y > 0:
	ans = 0
	maxi = max(x, y)
	mini = min(x, y)
	if mini < 0:
		ans = math.ceil(-mini / maxi)
	mini = mini + ans * maxi
	x = max(mini, maxi)
	y = min(mini, maxi)
	maxi = x
	mini = y
	while maxi < m:
		tmp = maxi + mini
		mini = maxi
		maxi = tmp
		ans = ans + 1
	print(ans)
else:
	print(-1)


z = [int(p) for p in input().split()]
m = z[2]
lst = []
lst.append(z[0])
lst.append(z[1])
tempi = min(lst)
tempa = max(lst)
count = 0
fibo = []
n = 1000000000000000000

def fib(n):
	(a, b) = (0, 1)
	while b < n:
		fibo.append(b)
		(a, b) = (b, a + b)

def add(m):
	n = 10 ** 18
	tempi = min(lst)
	tempa = max(lst)
	count = 0
	if tempi > 0 and tempa > 0 and (m > tempa):
		fib(n)
		for p in range(1, len(fibo) + 1):
			if fibo[p] * tempa + fibo[p - 1] * tempi >= m:
				count += p
				return count
	elif tempi == 0 or tempa == 0:
		count = 1
		fib(n)
		tempi = tempa + tempi
		for p in range(1, len(fibo)):
			if fibo[p] * tempa + fibo[p - 1] * tempi >= m:
				count += p
				return count
	elif tempi < 0 and tempa > 0:
		val = -tempi // tempa + 1
		count = val
		tempi = tempi + val * tempa
		fib(n)
		for p in range(1, len(fibo)):
			if fibo[p] * tempa + fibo[p - 1] * tempi >= m:
				count += p
				return count
if tempi > 0 and tempa > 0 and (m > tempa):
	cou = add(m)
	print(cou)
elif tempi > 0 and tempa > 0 and (m <= tempa):
	print(0)
elif tempi == 0:
	if tempi == 0 and tempa == 0 and (m > 0):
		print(-1)
	elif tempi == 0 and tempa == 0 and (m <= 0):
		print(0)
	elif tempa == 0 and tempi < 0 and (m > 0):
		print(-1)
	else:
		cou = add(m)
		print(cou)
elif tempi < 0 and tempa > 0:
	if m <= tempa:
		print(0)
	else:
		cou = add(m)
		print(cou)
elif tempi < 0 and tempa == 0:
	if m > 0:
		print(-1)
	else:
		print(0)
elif tempi < 0 and tempa < 0:
	if m >= 0:
		print(-1)
	elif m < 0 and m <= tempa:
		print(0)
	elif m < 0 and m > tempa:
		print(-1)


(a, b, c) = map(int, input().split())
k = 0
if a >= c or b >= c:
	print(0)
	exit()
if a <= 0 and b <= 0:
	print(-1)
	exit()
if a + b < 0:
	s = max(a, b) - min(a, b)
	k += abs(s // min(abs(min(a, b)), abs(max(a, b))))
	if a < b:
		a += k * min(abs(a), abs(b))
	else:
		b += k * min(abs(a), abs(b))
while a < c and b < c:
	if a < b:
		a = b + a
	else:
		b = b + a
	k += 1
print(k)


def Solve():
	(x, y, m) = list(map(int, input().split()))
	if x >= m or y >= m:
		return 0
	if x <= 0 and y <= 0:
		return -1
	ans = 0
	if y <= 0:
		ans = abs(y) // x + 1
		y += ans * x
	elif x <= 0:
		ans = abs(x) // y + 1
		x += ans * y
	while x < m and y < m:
		if x < y:
			x += y
		else:
			y += x
		ans += 1
	return ans
print(Solve())


(x, y, m) = list(map(int, input().split()))
if x > 0 or y > 0:
	a = 0
	while x < m and y < m:
		if x < y:
			a += (y - x) // y + 1
			x += y * ((y - x) // y + 1)
		else:
			a += (x - y) // x + 1
			y += x * ((x - y) // x + 1)
	print(a)
elif x >= m or y >= m:
	print(0)
else:
	print(-1)


import math
(x, y, m) = input().split()
ans = 0
x = int(x)
y = int(y)
m = int(m)
if x > y:
	t = y
	y = x
	x = t
if x < 0 and y > 0:
	t = abs(x)
	ans += math.ceil(t / y)
	x += math.ceil(t / y) * y
if x >= m or y >= m:
	print(0)
elif x <= 0 and y <= 0:
	print(-1)
else:
	while x < m and y < m:
		if x > y:
			t = y
			y = x
			x = t
		x = x + y
		ans += 1
	print(ans)


(x, y, m) = [int(i) for i in input().split(' ')]
(x, y) = (max(x, y), min(x, y))
b = 0
if x >= m:
	print(0)
	quit()
if x <= 0:
	print(-1)
	quit()
if x + y < 0:
	b = abs(y // x) + 1
	y += b * x
while max(x, y) < m:
	if x < y:
		x += y
	else:
		y += x
	b += 1
print(b)


(x, y, m) = map(int, input().split())
if not x < y:
	(x, y) = (y, x)
if m <= y:
	print(0)
elif y <= 0:
	print(-1)
else:
	i = 0
	if x < 0:
		j = -(x // y)
		x += j * y
		i += j
	while y < m:
		(x, y) = (y, x + y)
		i += 1
	print(i)


import os
import sys
from io import BytesIO, IOBase
import math
import itertools
import bisect
import heapq

def main():
	pass
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

def binary(n):
	return bin(n).replace('0b', '')

def decimal(s):
	return int(s, 2)

def pow2(n):
	p = 0
	while n > 1:
		n //= 2
		p += 1
	return p

def primeFactors(n):
	l = []
	while n % 2 == 0:
		l.append(2)
		n = n / 2
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			l.append(i)
			n = n / i
	if n > 2:
		l.append(int(n))
	return l

def isPrime(n):
	if n == 1:
		return False
	else:
		root = int(n ** 0.5)
		root += 1
		for i in range(2, root):
			if n % i == 0:
				return False
		return True

def maxPrimeFactors(n):
	maxPrime = -1
	while n % 2 == 0:
		maxPrime = 2
		n >>= 1
	for i in range(3, int(math.sqrt(n)) + 1, 2):
		while n % i == 0:
			maxPrime = i
			n = n / i
	if n > 2:
		maxPrime = n
	return int(maxPrime)

def countcon(s, i):
	c = 0
	ch = s[i]
	for i in range(i, len(s)):
		if s[i] == ch:
			c += 1
		else:
			break
	return c

def lis(arr):
	n = len(arr)
	lis = [1] * n
	for i in range(1, n):
		for j in range(0, i):
			if arr[i] > arr[j] and lis[i] < lis[j] + 1:
				lis[i] = lis[j] + 1
	maximum = 0
	for i in range(n):
		maximum = max(maximum, lis[i])
	return maximum

def isSubSequence(str1, str2):
	m = len(str1)
	n = len(str2)
	j = 0
	i = 0
	while j < m and i < n:
		if str1[j] == str2[i]:
			j = j + 1
		i = i + 1
	return j == m

def maxfac(n):
	root = int(n ** 0.5)
	for i in range(2, root + 1):
		if n % i == 0:
			return n // i
	return n

def p2(n):
	c = 0
	while n % 2 == 0:
		n //= 2
		c += 1
	return c

def seive(n):
	primes = [True] * (n + 1)
	primes[1] = primes[0] = False
	for i in range(2, n + 1):
		if primes[i]:
			for j in range(i + i, n + 1, i):
				primes[j] = False
	p = []
	for i in range(0, n + 1):
		if primes[i]:
			p.append(i)
	return p

def ncr(n, r, p):
	num = den = 1
	for i in range(r):
		num = num * (n - i) % p
		den = den * (i + 1) % p
	return num * pow(den, p - 2, p) % p

def denofactinverse(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return pow(fac, m - 2, m)

def numofact(n, m):
	fac = 1
	for i in range(1, n + 1):
		fac = fac * i % m
	return fac

def getPos(l, m):
	for i in range(n - 1, -1, -1):
		if l[i] % 3 == m:
			return [i]
	m = 3 - m
	rv = []
	for i in range(n - 1, -1, -1):
		if l[i] % 3 == m:
			rv.append(i)
		if len(rv) == 2:
			break
	if len(rv) == 2:
		return rv
	else:
		return [-1]
(x, y, m) = map(int, input().split())
(x, y) = (min(x, y), max(x, y))
if y <= 0 and y < m:
	print(-1)
elif y >= m:
	print(0)
else:
	t = (y - x + y - 1) // y
	x += y * t
	ans = t
	while x < m:
		(x, y) = (x + y, x)
		ans += 1
	print(ans)


(x, y, m) = [int(number) for number in input().split()]
(x, y) = (min(x, y), max(x, y))
if y >= m:
	print(0)
	quit()
if y <= 0:
	print(-1)
	quit()
answer = 0
if x < 0:
	answer += (-x + y - 1) // y
	x += answer * y
(x, y) = (min(x, y), max(x, y))
if y >= m:
	print(answer)
	quit()
while y < m:
	(x, y) = (y, x + y)
	answer += 1
print(answer)


k = 0
(x, y, m) = map(int, input().split())
if y < x:
	(x, y) = (y, x)
if y >= m:
	print(0)
elif x <= 0 and y <= 0:
	print(-1)
else:
	if x <= 0 and y > 0:
		if abs(x) % y > 0:
			k += abs(x) // y + 1
		else:
			k += abs(x) // y
		x = x + y * k
	a = 0
	b = 1
	c = 0
	while c < 5000000000000000000:
		if a * x + b * y >= m:
			print(k)
			break
		c = a + b
		a = b
		b = c
		k += 1
	if c >= 5000000000000000000:
		print(-1)


import math
(x, y, m) = map(int, input().split())
(x, y) = (min(x, y), max(x, y))
if y >= m:
	print(0)
elif y <= 0:
	print(-1)
else:
	cnt = 0
	if x < 0:
		cnt += math.ceil(-x / y)
		x = x + cnt * y
	while y < m:
		(x, y) = (y, x + y)
		cnt += 1
	print(cnt)


import bisect
from itertools import accumulate, count
import os
import sys
import math
from decimal import *
from io import BytesIO, IOBase
from sys import maxsize
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

def SieveOfEratosthenes(n):
	prime = []
	primes = [True for i in range(n + 1)]
	p = 2
	while p * p <= n:
		if primes[p] == True:
			prime.append(p)
			for i in range(p * p, n + 1, p):
				primes[i] = False
		p += 1
	return prime

def primefactors(n):
	fac = []
	while n % 2 == 0:
		fac.append(2)
		n = n // 2
	for i in range(3, int(math.sqrt(n)) + 2):
		while n % i == 0:
			fac.append(i)
			n = n // i
	if n > 1:
		fac.append(n)
	return sorted(fac)

def factors(n):
	fac = set()
	fac.add(1)
	fac.add(n)
	for i in range(2, int(math.sqrt(n)) + 1):
		if n % i == 0:
			fac.add(i)
			fac.add(n // i)
	return list(fac)

def modInverse(a, m):
	m0 = m
	y = 0
	x = 1
	if m == 1:
		return 0
	while a > 1:
		q = a // m
		t = m
		m = a % m
		a = t
		t = y
		y = x - q * y
		x = t
	if x < 0:
		x = x + m0
	return x
(x, y, m) = map(int, input().split())
(x, y) = (min(x, y), max(x, y))
if y >= m:
	print(0)
elif y <= 0:
	print(-1)
else:
	c = 0
	while y < m:
		q = (2 * y - x) // y
		c += q
		(x, y) = (y, x + q * y)
	print(c)


(x, y, m) = map(int, input().split())
if x <= 0 and y <= 0:
	if m <= max(x, y):
		print(0)
	else:
		print(-1)
else:
	if m <= max(x, y):
		print(0)
		exit()
	if x > y:
		(x, y) = (y, x)
	op = 0
	if x < 0:
		ad = (abs(x) + y - 1) // y
		op += ad
		x += y * ad
	while max(x, y) < m:
		(x, y) = (max(x, y), x + y)
		op += 1
	print(op)


from math import ceil
(a, b, m) = [int(i) for i in input().split()]
if a > b:
	(a, b) = (b, a)
if b >= m:
	print(0)
	exit(0)
if a <= 0 and b <= 0:
	print(-1)
	exit(0)
f1 = 1
f2 = 1
i = 1
if a < 0:
	i += ceil(abs(a) / b)
	a += b * ceil(abs(a) / b)
while 1:
	if a * f1 + b * f2 >= m:
		print(i)
		exit(0)
	i += 1
	f2 += f1
	f1 = f2 - f1


(x, y, m) = [int(x) for x in input().split()]
(x, y) = (min(x, y), max(x, y))
if y >= m:
	print(0)
	exit(0)
if y <= 0:
	print(-1)
	exit(0)
c = 0
if x < 0 and y > 0:
	if m <= 0:
		c = (m - x) // y
	else:
		c = -x // y
	x += c * y
while x < m and y < m:
	xx = x + y
	if xx <= min(x, y):
		print(-1)
		exit(0)
	(x, y) = (xx, max(x, y))
	c += 1
print(c)


from math import ceil
(x, y, m) = map(int, input().split())
if max(x, y) >= m:
	exit(print(0))
if x <= 0 and y <= 0:
	exit(print(-1))
(x, y) = (min(x, y), max(x, y))
steps = 0
if x < 0:
	steps += ceil((abs(x) + y - 1) / y)
	csteps = ceil((abs(x) + y - 1) / y)
	x = y * csteps + x
while max(x, y) < m:
	(x, y) = (x + y, max(x, y))
	steps += 1
exit(print(steps))


def ceil(a, b):
	if a % b:
		return a // b + 1
	return a // b
(x, y, m) = map(int, input().split())
if max(x, y) >= m:
	print(0)
	exit()
elif max(x, y) <= 0 and max(x, y) < m:
	print(-1)
	exit()
ans = 0
(x, y) = (min(x, y), max(x, y))
if x < 0:
	ans = ceil(abs(x), y)
	x += ans * y
c = ans
while max(x, y) < m:
	if x < y:
		x = x + y
	else:
		y += x
	c += 1
print(c)


(x, y, m) = map(int, input().split())
if max(x, y) < m and max(x, y) <= 0:
	print(-1)
	exit()
ans = 0
while max(x, y) < m:
	if x < y:
		(x, y) = (y, x)
	if y < 0:
		k = (abs(y) + x - 1) // x
		ans += k
		y += k * x
	else:
		y += x
		ans += 1
print(ans)


def solve(x, y, m):
	if x >= m or y >= m:
		print(0)
		return
	if x <= 0 and y <= 0:
		print(-1)
		return
	if x > y:
		(x, y) = (y, x)
	cnt = 0
	if x <= 0:
		div = abs(x) // y + 1
		x = div * y + x
		cnt += div
	while y < m:
		x += y
		(x, y) = (y, x)
		cnt += 1
	print(cnt)
(x, y, m) = map(int, input().split())
solve(x, y, m)


(x, y, m) = map(int, input().split())
if x < y:
	(x, y) = (y, x)
if x >= m:
	print(0)
elif x > 0:
	s = 0
	if y < 0:
		s = -y // x + 1
		y += x * s
	while x < m:
		(x, y) = (x + y, x)
		s += 1
	print(s)
elif x < m:
	print(-1)
else:
	print(0)


(x, y, m) = [int(x) for x in input().split()]
if x >= m or y >= m:
	print(0)
	exit()
if x <= 0 and y <= 0:
	print(-1)
	exit()
res = 0
if x < 0:
	res -= x // y
	x %= y
if y < 0:
	res -= y // x
	y %= x
while x < m and y < m:
	if x < y:
		x = x + y
	else:
		y = x + y
	res += 1
print(res)


from sys import stdin, stdout
from math import ceil
nmbr = lambda : int(stdin.readline())
lst = lambda : list(map(int, stdin.readline().split()))

def fn(a, b):
	op = 0
	while max(a, b) < m:
		a1 = max(a, b) + min(a, b)
		b1 = max(a, b)
		(a, b) = (a1, b1)
		op += 1
	return op
for _ in range(1):
	(a, b, m) = lst()
	if a > b:
		(a, b) = (b, a)
	if max(a, b) >= m:
		print(0)
		continue
	if a <= 0 and b <= 0:
		if a + b >= m:
			print(0)
		else:
			print(-1)
		continue
	if a > 0 and b > 0:
		print(fn(a, b))
		continue
	if a <= 0 and b > 0:
		terms = ceil(-a / b)
		start = a + terms * b
		print(terms + fn(start, b))
		continue
	print(-1)


(x, y, m) = map(int, input().split())
if x <= 0 and y <= 0:
	if x >= m or y >= m:
		print(0)
	else:
		print(-1)
else:
	if x >= m or y >= m:
		print(0)
		exit(0)
	init = 0
	if x <= 0:
		init = (-x + y - 1) // y
		x += init * y
	elif y <= 0:
		init = (-y + x - 1) // x
		y += init * x
	ctr = 0
	while x < m and y < m:
		if x <= y:
			x += y
		else:
			y += x
		ctr += 1
	print(init + ctr)


from sys import stdin
from math import ceil
(x, y, m) = map(int, stdin.readline().split())
ans = 0
if x >= m or y >= m:
	print(ans)
elif x + y > min(x, y):
	(ma, mi) = (max(x, y), min(x, y))
	ans += (ma - mi) // ma
	(mi, ma) = (min(ma, mi + ans * ma), max(ma, mi + ans * ma))
	while ma < m:
		(ma, mi) = (ma + mi, ma)
		ans += 1
	print(ans)
else:
	print(-1)


def change(x, y):
	if x > y:
		tmp = y
		y = x
		x = tmp
	return (x, y)
(x, y, m) = [int(x) for x in input().split()]
if x >= m or y >= m:
	ans = 0
elif x <= 0 and y <= 0:
	ans = -1
else:
	ans = 0
	(x, y) = change(x, y)
	if x < 0:
		ans = int(-x / y)
		ans += 1
		x = y - -x % y
	while y < m:
		tmp = x + y
		x = y
		y = tmp
		(x, y) = change(x, y)
		ans += 1
print(ans)


from math import *
(x, y, m) = map(int, input().split())
if x < y:
	(x, y) = (y, x)
ans = 0
if x >= m:
	print(0)
elif x + y <= y:
	print(-1)
else:
	while x < m:
		ans += (x - y) // x
		y += (x - y) // x * x
		while x >= y:
			y += x
			ans += 1
		(x, y) = (y, x)
	print(ans)


import os
import sys
from math import *
from collections import *
from fractions import *
from bisect import *
from heapq import *
from io import BytesIO, IOBase

def vsInput():
	sys.stdin = open('input.txt', 'r')
	sys.stdout = open('output.txt', 'w')
BUFSIZE = 8192

class FastIO(IOBase):
	newlines = 0

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

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

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

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

class IOWrapper(IOBase):

	def __init__(self, file):
		self.buffer = FastIO(file)
		self.flush = self.buffer.flush
		self.writable = self.buffer.writable
		self.write = lambda s: self.buffer.write(s.encode('ascii'))
		self.read = lambda : self.buffer.read().decode('ascii')
		self.readline = lambda : self.buffer.readline().decode('ascii')
(sys.stdin, sys.stdout) = (IOWrapper(sys.stdin), IOWrapper(sys.stdout))
input = lambda : sys.stdin.readline().rstrip('\r\n')

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

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

def Int():
	return int(input())

def Str():
	return input()

def arrayS():
	return [i for i in input().split()]
(x, y, m) = value()
(x, y) = sorted((x, y))
steps = 0
if y >= m:
	print(0)
elif y <= 0:
	print(-1)
else:
	if x < 0:
		steps += (y - x) // y
		x += y * steps
	while y < m:
		(x, y) = sorted((y, x + y))
		steps += 1
	print(steps)


(x, y, m) = map(int, input().split())
k = 0
if x > y:
	(x, y) = (y, x)
if x >= m or y >= m:
	print(0)
elif x < 0 and y < 0 and (m > 0):
	print(-1)
elif x > 0 and y > 0 and (m < 0):
	print(-1)
elif x + y <= x and x + y <= y:
	print(-1)
else:
	k = (y - x + y - 1) // y
	x += y * k
	while x < m and y < m:
		if x < y:
			x = x + y
		else:
			y = x + y
		k += 1
	print(k)


(x, y, m) = list(map(int, input().split()))
result = 0
if x <= 0 and y <= 0:
	if x < m and y < m:
		print(-1)
	else:
		print(0)
	return
while x < m and y < m:
	(x, y) = (y, x) if x > y else (x, y)
	tmp = (2 * y - x - 1) // y
	if tmp == 0:
		tmp = 1
	result += tmp
	x = x + tmp * y
print(result)


import math
(x, y, m) = map(int, input().split())
c = 0
(x, y) = (min(x, y), max(x, y))
if y >= m:
	print(0)
	exit()
elif x <= 0 and y <= 0:
	print('-1')
	exit()
elif x < 0 and y > 0:
	c += math.ceil(-1 * x / y)
	x += y * math.ceil(-1 * x / y)
while y < m:
	(x, y) = (y, x + y)
	c += 1
print(c)


(a, b, c) = [int(x) for x in input().split()]
d = 200
pocet = 0
while True:
	if a > b:
		(a, b) = (b, a)
	if b >= c:
		print(pocet)
		quit()
	d -= 1
	if d < 0:
		print(-1)
		quit()
	if b < -1000:
		print(-1)
		quit()
	if a < 0 and b > 0:
		x = max(1, -a // b - 5)
		pocet += x
		a = a + x * b
	else:
		pocet += 1
		a = a + b


def doit():
	(x, y, m) = [int(k) for k in input().strip().split()]
	if x < y:
		(x, y) = (y, x)
	if x >= m:
		print(0)
		return
	if x <= 0 and y <= 0:
		print(-1)
		return
	k = 0
	if y < 0:
		k = (-y + x - 1) // x
		y += k * x
		assert y >= 0
	if x < y:
		(x, y) = (y, x)
	while x < m:
		k += 1
		(x, y) = (x + y, x)
		if x < y:
			(x, y) = (y, x)
	print(k)
doit()


(a, b, m) = map(int, input().split())
if a > b:
	(b, a) = (a, b)
if b >= m:
	print(0)
	exit()
elif b <= 0:
	print('-1')
	exit()
ans = 0
if a < 0:
	ans += abs(a) // b
	a += ans * b
while max(a, b) < m:
	if a > b:
		b = a + b
	else:
		a = a + b
	ans += 1
print(ans)


def main():
	(a, b, m) = list(map(int, input().split()))
	if a > b:
		(a, b) = (b, a)
	if m <= b:
		print(0)
		return
	if b <= 0:
		print(-1)
		return
	i = max((b - a) // b, 0)
	a += b * i
	while b < m:
		(a, b, i) = (b, a + b, i + 1)
	print(i)

def __starting_point():
	main()
__starting_point()


from collections import *
from math import *
from sys import *
(n, m, k) = map(int, input().split())
if max(m, n) >= k:
	print(0)
elif n + m > min(n, m):
	ct = 0
	if n < 0:
		ct = ceil(-n / m)
		n = n + ct * m
	elif m < 0:
		ct = ceil(-m / n)
		m = m + ct * n
	while max(n, m) < k:
		if n < m:
			n = n + m
		else:
			m = n + m
		ct += 1
	print(ct)
else:
	print(-1)


(x, y, m) = map(int, input().strip().split())
(x, y) = (min(x, y), max(x, y))
if y >= m:
	print(0)
elif y <= 0:
	print(-1)
elif x >= 0:
	i = 0
	while y < m:
		(x, y) = (min(x + y, y), max(x + y, y))
		i += 1
	print(i)
else:
	n = (y - x) // y
	if n * y + x < y:
		n += 1
	if n * y + x >= m:
		print(n)
	else:
		i = n
		(x, y) = (y, n * y + x)
		while y < m:
			(x, y) = (min(x + y, y), max(x + y, y))
			i += 1
		print(i)


(x, y, m) = map(int, input().split())
if max(x, y) >= m:
	print(0)
elif max(x, y) <= 0:
	print(-1)
else:
	(p, val) = (sorted([x, y]), 0)
	if p[0] < 0:
		s = (min(m, 0) - p[0]) // p[1]
		p[0] += s * p[1]
		val += s
	while max(p) < m:
		(p, val) = ([sum(p), max(p)], val + 1)
	print(val)