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?

Single line of the input contains three integers x, y and m ( - 1018 ≤ x, y, m ≤ 1018). 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.

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

NoteIn the first sample the following sequence of operations is suitable: (1, 2)  (3, 2)  (5, 2).In the second sample: (-1, 4)  (3, 4)  (7, 4)  (11, 4)  (15, 4).Finally, in the third sample x, y cannot be made positive, hence there is no proper sequence of operations.

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;

public class MonstersValley2
{

    public static void Main()
    {
        string str = Console.ReadLine();
        string[] values = str.Split(' ');
        long x = long.Parse(values[0]);
        long y = long.Parse(values[1]);
        long m = long.Parse(values[2]);

        long ans = 0,a,b;
        if (Math.Max(x, y) >= m)
            { Console.WriteLine(0); }

        else if ((x + y) <= Math.Min(x, y))
            { Console.WriteLine(-1); }
        else
        {
            if (Math.Min(x, y) < 0)
            {
                ans = ans + (long)Math.Floor(-Math.Min(x, y) / (double)Math.Max(x, y));
                b = Math.Max(x, y);
                a = Math.Min(x, y) + ans *b;
                y = b;
                x = a;
            }
            while ((Math.Max(x, y) < m))
            {
                a = x;
                b = y;
                b = x >= y ? x + y : y;
                a = x >= y ? x : x + y;
                ans++;
                x = a;
                y = b;
            }
            Console.WriteLine(ans);
        }

        Console.ReadLine();

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeForces
{
    class R188_Div2_C
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            long x = long.Parse(s[0]);
            long y = long.Parse(s[1]);
            long m = long.Parse(s[2]);

            long x2 = x;
            long y2 = y;
            long cnt = 0, sum;
            while (x2 < m && y2 < m && (x2+y2 >0 || (x2+y2 > Math.Min(x2,y2))))
            {
                long min = Math.Min(x2, y2);
                long max = Math.Max(x2, y2);
                if (min < 0 && Math.Abs(min) > max)
                {
                    long num = Math.Abs(min) / max;
                    cnt += num;
                    min += num * max;
                    x2 = min; y2 = max;
                }
                sum = x2 + y2;
                if (x2 < y2)
                    x2 = sum;
                else
                    y2 = sum;
                cnt++;
            }
            if (x2 < m && y2 < m)
                Console.WriteLine(-1);
            else
                Console.WriteLine(cnt);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
	class C
	{
		static void Main(string[] args)
		{
		  string[] token = Console.ReadLine().Split();

		  long x = long.Parse(token[0]);
		  long y = long.Parse(token[1]);
		  long m = long.Parse(token[2]);

		  if(x>=m||y>=m)
		  {
		     Console.WriteLine(0);
		     return;
		  }
		  if(x<=0&&y<=0)
		  {
		     Console.WriteLine(-1);
		     return;
		  }

		  long count = 0;
		  if(x < 0)
		  {
		    count = (Math.Abs(x)/y) + 1;
		    x = y - (Math.Abs(x)%y);
		  }else if(y < 0){
		    count = (Math.Abs(y)/x) + 1;
		    y = x - (Math.Abs(y)%x);
		  }

		  while(x<m && y<m)
		  {
		     if(x<y)
		     {
		        x = x + y;
		     }else
		     {
		        y = x + y;
		     }
		     count++;
		    // Console.WriteLine(x + " and " + y);
		  }
		   Console.WriteLine(count);

		}

	}
}

using System;
class Program
    {
        static void Main(string[] args)
        {
            long a, b, c;
            {
                string[] input = Console.ReadLine().Split(new char[] {'\t', ' ' },StringSplitOptions.RemoveEmptyEntries);
                a = long.Parse(input[0]); b = long.Parse(input[1]);
                if(a>b) { c = a; a = b; b = c; }
                c = long.Parse(input[2]);
            }
            if (b<c && a<=0L && b<=0L) Console.WriteLine("-1");
            else
            {
                long counter = 0L;
                if(c>b)
                {
                    long temp=Math.Abs(a);
                    if (a<0L)
                    {
                        counter += ((temp / b) + (temp % b > 0L ? 1L : 0L));
                        a += b * counter;
                    }
                    while (b < c)
                    {
                        counter++;
                        a += b;
                        temp = b;
                        b = a;
                        a = temp;
                    }
                }
                Console.WriteLine(counter);
            }
        }
    }

using System;
class Demo
{
    static void Main()
    {
        long ans = 0;
        var str = Console.ReadLine().Split();
        long x = long.Parse(str[0]), tx;
        long y = long.Parse(str[1]);
        long m = long.Parse(str[2]);
        if (x >= m | y >= m) ans = 0;
        else if (x <= 0 & y <= 0) ans = -1;
        else
        {
            if (y < x) { tx = x; x = y; y = tx; }
            if (x < 0)
            {
                ans += Math.Abs(x) / y;
                ans++;
                x = y * ans + x;
            }
            while (x < m & y < m)
            {
                if (x < y) x = x + y;
                else y = x + y;
                ans++;
            }
        }
        Console.WriteLine(ans);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeForces.Solutions.c318_188_2
{
    public class Program3
    {
        public static long[] ReadLongs(int n)
        {
            var s = Console.ReadLine() + " ";
            var result = new long[n];
            var i = 0;
            var acc = 0L;
            var i2 = 0;
            while (i < n)
            {
                if (s[i2] == ' ')
                {
                    result[i++] = acc;
                    i2++;
                    acc = 0;
                }
                else
                    acc = acc*10 + (s[i2++] - '0');
            }
            return result;
        }

        public static void ReadLongs(out long l1, out long l2)
        {
            var ls = ReadLongs(2);
            l1 = ls[0];
            l2 = ls[1];
        }

        public static void ReadLongs(out long l1, out long l2, out long l3)
        {
            var ls = ReadLongs(3);
            l1 = ls[0];
            l2 = ls[1];
            l3 = ls[2];
        }

        public static void ReadLongs(out long l1, out long l2, out long l3, out long l4)
        {
            var ls = ReadLongs(4);
            l1 = ls[0];
            l2 = ls[1];
            l3 = ls[2];
            l4 = ls[3];
        }

        public static void Main()
        {
            checked
            {
                var s1 = Console.ReadLine().Split(' ').Select(long.Parse).ToArray();
                var x=  s1[0];
                var y=  s1[1];
                var m=  s1[2];

                if (x >= m || y >= m)
                {
                    Console.Write(0);
                    return;
                }

                if (x <= 0 && y <= 0)
                {
                    Console.WriteLine(-1);
                    return;
                }

                if (y > x)
                {
                    var tmp = y;
                    y = x;
                    x = tmp;
                }

                var steps = 0L;
                if (y < 0)
                {
                    steps = (-y + 1 + x - 1)/x;
                    y += x*steps;
                }

                if (y > x)
                {
                    var tmp = y;
                    y = x;
                    x = tmp;
                }

                do
                {
                    var s = x + y;
                    y = x;
                    x = s;
                    steps++;
                } while (x < m);
                Console.Write(steps);
            }
        }

        public static void Generated(StringBuilder sb)
        {
            var x = 1L;
            var y = -1000000000000000000;
            var m = 1000000000000000000;
            sb.AppendFormat("{0} {1} {2}", x, y, m);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace tmp11
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] inp = Console.ReadLine().Split(' ');
            long l = Convert.ToInt64(inp[0]);
            long r = Convert.ToInt64(inp[1]);
            long m = Convert.ToInt64(inp[2]);
            long delta, deltal;
            delta = m - (l + r);
            deltal = delta;

            long steps = 0;
            if (l < 0 && r > 0 && l < m && r < m)
            {
                steps = Math.Abs(l / r);
                l += r * steps;
            }
            if (l > 0 && r < 0 && l < m && r < m)
            {
                steps = Math.Abs(r / l);
                r += l * steps;
            }
            while (true)
            {
                if (l >= m || r >= m)
                {
                    Console.WriteLine(steps);
                    return;
                }

                if (l > r)
                {
                    r += l;
                }
                else
                {
                    l += r;
                }
                delta = m - (l + r);
                if (delta - deltal >= 0)
                {
                    Console.WriteLine(-1);
                    return;
                }
                deltal = delta;
                steps++;
            }
        }
    }
}

using System;
using System.IO;
using System.Text;

namespace Perfect_Pair
{
    internal class Program
    {
        private static readonly StreamReader reader = new StreamReader(Console.OpenStandardInput(1024*10), Encoding.ASCII, false, 1024*10);
        private static readonly StreamWriter writer = new StreamWriter(Console.OpenStandardOutput(1024*10), Encoding.ASCII, 1024*10);

        private static void Main(string[] args)
        {
            long x = Next();
            long y = Next();
            long m = Next();

            if (Math.Max(x, y) >= m)
                writer.WriteLine("0");
            else
            {
                if (x + y <= Math.Min(x, y))
                    writer.WriteLine("-1");
                else
                {
                    long moves = 1;
                    if (Math.Max(x, y) > 0 && Math.Min(x, y) < 0)
                    {
                        moves = -Math.Min(x, y)/Math.Max(x, y);

                        long d = Math.Max(x, y);
                        long c = Math.Min(x, y) + moves*d;

                        x = c;
                        y = d;

                        moves++;
                    }
                    for (long i = moves;; i++)
                    {
                        long c = x + y;
                        long d = Math.Max(x, y);

                        x = c;
                        y = d;

                        if (Math.Max(x, y) >= m)
                        {
                            writer.WriteLine(i);
                            break;
                        }
                    }
                }
            }
            writer.Flush();
        }

        private static long Next()
        {
            int c;
            long res = 0;
            int m = 1;
            do
            {
                c = reader.Read();
                if (c == '-')
                    m = -1;
                if (c == -1)
                    return res;
            } while (c < '0' || c > '9');
            res = c - '0';
            while (true)
            {
                c = reader.Read();
                if (c < '0' || c > '9')
                    return m*res;
                res *= 10;
                res += c - '0';
            }
        }
    }
}

using System;
using System.Linq;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Globalization;
using System.Collections.Generic;
using System.Threading;
using kp.Algo;

namespace CodeForces
{
	internal class Solution
	{
		const int StackSize = 20 * 1024 * 1024;

		private void Solve()
		{
			long a = NextLong(), b = NextLong(), m = NextLong();
			if ( a >= m || b >= m )
			{
				Out.WriteLine( 0 );
				return;
			}
			if ( a <= 0 && b <= 0 )
			{
				Out.WriteLine( -1 );
				return;
			}
			if ( a > b )
			{
				long c = a;
				a = b;
				b = c;
			}
			long res = 0;
			if ( a < 0 )
			{
				long k = ( Math.Abs( a ) + b - 1 ) / b;
				res += k;
				a += b * k;
			}

			if ( a == 0 )
			{
				++res;
				a += b;
			}

			long add = long.MaxValue;
			for ( int z = 0; z < 1000; ++z )
			{
				long x = a, y = b, cur = 0;
				for ( int t = 0; t < z; ++t )
				{
					if ( x >= m || y >= m ) break;
					++cur;
					if ( x < y ) x += y;
					else y += x;
				}

				if ( !( x >= m || y >= m ) )
				{
					long p = Math.Min( ( m - x + y - 1 ) / y, ( m - y + x - 1 ) / x );
					cur += p;
				}

				add = Math.Min( add, cur );
			}

			Out.WriteLine( res + add );
		}

		#region Local wireup

		public int[] NextIntArray( int size )
		{
			var res = new int[size];
			for ( int i = 0; i < size; ++i ) res[i] = NextInt();
			return res;
		}

		public long[] NextLongArray( int size )
		{
			var res = new long[size];
			for ( int i = 0; i < size; ++i ) res[i] = NextLong();
			return res;
		}

		public double[] NextDoubleArray( int size )
		{
			var res = new double[size];
			for ( int i = 0; i < size; ++i ) res[i] = NextDouble();
			return res;
		}

		public int NextInt()
		{
			return _in.NextInt();
		}

		public long NextLong()
		{
			return _in.NextLong();
		}

		public string NextLine()
		{
			return _in.NextLine();
		}

		public double NextDouble()
		{
			return _in.NextDouble();
		}

		readonly Scanner _in = new Scanner();
		static readonly TextWriter Out = Console.Out;

		void Start()
		{
#if !ONLINE_JUDGE
			var timer = new Stopwatch();
			timer.Start();
#endif
			var t = new Thread( Solve, StackSize );
			t.Start();
			t.Join();
#if !ONLINE_JUDGE
			timer.Stop();
			Console.WriteLine( string.Format( CultureInfo.InvariantCulture, "Done in {0} seconds.\nPress <Enter> to exit.", timer.ElapsedMilliseconds / 1000.0 ) );
			Console.ReadLine();
#endif
		}

		static void Main()
		{
			new Solution().Start();
		}

		class Scanner : IDisposable
		{
			#region Fields

			readonly TextReader _reader;
			readonly int _bufferSize;
			readonly bool _closeReader;
			readonly char[] _buffer;
			int _length, _pos;

			#endregion

			#region .ctors

			public Scanner( TextReader reader, int bufferSize, bool closeReader )
			{
				_reader = reader;
				_bufferSize = bufferSize;
				_closeReader = closeReader;
				_buffer = new char[_bufferSize];
				FillBuffer( false );
			}

			public Scanner( TextReader reader, bool closeReader ) : this( reader, 1 << 16, closeReader ) { }

			public Scanner( string fileName ) : this( new StreamReader( fileName, Encoding.Default ), true ) { }

#if ONLINE_JUDGE
			public Scanner() : this( Console.In, false ) { }
#else
			public Scanner() : this( "input.txt" ) { }
#endif

			#endregion

			#region IDisposable Members

			public void Dispose()
			{
				if ( _closeReader )
				{
					_reader.Close();
				}
			}

			#endregion

			#region Properties

			public bool Eof
			{
				get
				{
					if ( _pos < _length ) return false;
					FillBuffer( false );
					return _pos >= _length;
				}
			}

			#endregion

			#region Methods

			private char NextChar()
			{
				if ( _pos < _length ) return _buffer[_pos++];
				FillBuffer( true );
				return _buffer[_pos++];
			}

			private char PeekNextChar()
			{
				if ( _pos < _length ) return _buffer[_pos];
				FillBuffer( true );
				return _buffer[_pos];
			}

			private void FillBuffer( bool throwOnEof )
			{
				_length = _reader.Read( _buffer, 0, _bufferSize );
				if ( throwOnEof && Eof )
				{
					throw new IOException( "Can't read beyond the end of file" );
				}
				_pos = 0;
			}

			public int NextInt()
			{
				var neg = false;
				int res = 0;
				SkipWhitespaces();
				if ( !Eof && PeekNextChar() == '-' )
				{
					neg = true;
					_pos++;
				}
				while ( !Eof && !IsWhitespace( PeekNextChar() ) )
				{
					var c = NextChar();
					if ( c < '0' || c > '9' ) throw new ArgumentException( "Illegal character" );
					res = 10 * res + c - '0';
				}
				return neg ? -res : res;
			}

			public long NextLong()
			{
				var neg = false;
				long res = 0;
				SkipWhitespaces();
				if ( !Eof && PeekNextChar() == '-' )
				{
					neg = true;
					_pos++;
				}
				while ( !Eof && !IsWhitespace( PeekNextChar() ) )
				{
					var c = NextChar();
					if ( c < '0' || c > '9' ) throw new ArgumentException( "Illegal character" );
					res = 10 * res + c - '0';
				}
				return neg ? -res : res;
			}

			public string NextLine()
			{
				SkipUntilNextLine();
				if ( Eof ) return "";
				var builder = new StringBuilder();
				while ( !Eof && !IsEndOfLine( PeekNextChar() ) )
				{
					builder.Append( NextChar() );
				}
				return builder.ToString();
			}

			public double NextDouble()
			{
				SkipWhitespaces();
				var builder = new StringBuilder();
				while ( !Eof && !IsWhitespace( PeekNextChar() ) )
				{
					builder.Append( NextChar() );
				}
				return double.Parse( builder.ToString(), CultureInfo.InvariantCulture );
			}

			private void SkipWhitespaces()
			{
				while ( !Eof && IsWhitespace( PeekNextChar() ) )
				{
					++_pos;
				}
			}

			private void SkipUntilNextLine()
			{
				while ( !Eof && IsEndOfLine( PeekNextChar() ) )
				{
					++_pos;
				}
			}

			private static bool IsWhitespace( char c )
			{
				return c == ' ' || c == '\t' || c == '\n' || c == '\r';
			}

			private static bool IsEndOfLine( char c )
			{
				return c == '\n' || c == '\r';
			}

			#endregion
		}

		#endregion
	}
}

namespace kp.Algo { }

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;

namespace Temp
{
    public class PointInt
    {
        public long X;

        public long Y;

        public PointInt(long x, long y)
        {
            this.X = x;
            this.Y = y;
        }

        public PointInt(PointInt head)
            : this(head.X, head.Y)
        {
        }

        public static PointInt operator +(PointInt a, PointInt b)
        {
            return new PointInt(a.X + b.X, a.Y + b.Y);
        }

        public static PointInt operator -(PointInt a, PointInt b)
        {
            return new PointInt(a.X - b.X, a.Y - b.Y);
        }

        public static PointInt operator *(PointInt a, long k)
        {
            return new PointInt(k * a.X, k * a.Y);
        }

        public static PointInt operator *(long k, PointInt a)
        {
            return new PointInt(k * a.X, k * a.Y);
        }

        public bool IsInsideRectangle(long l, long b, long r, long t)
        {
            return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);
        }

        public bool Equals(PointInt other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }
            if (ReferenceEquals(this, other))
            {
                return true;
            }
            return other.X == this.X && other.Y == this.Y;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }
            if (ReferenceEquals(this, obj))
            {
                return true;
            }
            if (obj.GetType() != typeof(PointInt))
            {
                return false;
            }
            return Equals((PointInt)obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return (this.X.GetHashCode() * 397) ^ this.Y.GetHashCode();
            }
        }
    }

    public class Point2DReal
    {
        public double X;

        public double Y;

        public Point2DReal(double x, double y)
        {
            this.X = x;
            this.Y = y;
        }

        public Point2DReal(Point2DReal head)
            : this(head.X, head.Y)
        {
        }

        public static Point2DReal operator +(Point2DReal a, Point2DReal b)
        {
            return new Point2DReal(a.X + b.X, a.Y + b.Y);
        }

        public static Point2DReal operator -(Point2DReal a, Point2DReal b)
        {
            return new Point2DReal(a.X - b.X, a.Y - b.Y);
        }

        public static Point2DReal operator *(Point2DReal a, double k)
        {
            return new Point2DReal(k * a.X, k * a.Y);
        }

        public static Point2DReal operator *(double k, Point2DReal a)
        {
            return new Point2DReal(k * a.X, k * a.Y);
        }

        public double Dist(Point2DReal p)
        {
            return Math.Sqrt((p.X - X)*(p.X - X) + (p.Y - Y)*(p.Y - Y));
        }

        public bool IsInsideRectangle(double l, double b, double r, double t)
        {
            return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);
        }
    }

    internal class LineInt
    {
        public LineInt(PointInt a, PointInt b)
        {
            A = a.Y - b.Y;
            B = b.X - a.X;
            C = a.X * b.Y - a.Y * b.X;
        }

        public long A, B, C;

        public bool ContainsPoint(PointInt p)
        {
            return A * p.X + B * p.Y + C == 0;
        }

        public int Sign(PointInt p)
        {
            return Math.Sign(A * p.X + B * p.Y + C);
        }
    }

    internal static class Geometry
    {
        public static long VectInt(PointInt a, PointInt b)
        {
            return a.X * b.Y - a.Y * b.X;
        }

        public static long VectInt(PointInt a, PointInt b, PointInt c)
        {
            return (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);
        }
    }

    internal class MatrixInt
    {
        private readonly long[,] m_Matrix;

        public int Size
        {
            get
            {
                return m_Matrix.GetLength(0);
            }
        }

        public long Mod { get; private set; }

        public MatrixInt(int size, long mod = 0)
        {
            m_Matrix = new long[size,size];
            Mod = mod;
        }

        public MatrixInt(long[,] matrix, long mod = 0)
        {
            var size = matrix.GetLength(0);
            m_Matrix = new long[size,size];
            Array.Copy(matrix, m_Matrix, size * size);
            Mod = mod;

            if (mod != 0)
            {
                for (int i = 0; i < size; i++)
                {
                    for (int j = 0; j < size; j++)
                    {
                        m_Matrix[i, j] %= mod;
                    }
                }
            }
        }

        public static MatrixInt IdentityMatrix(int size, long mod = 0)
        {
            long[,] matrix = new long[size,size];

            for (int i = 0; i < size; i++)
            {
                matrix[i, i] = 1;
            }

            return new MatrixInt(matrix, mod);
        }

        public long this[int i, int j]
        {
            get
            {
                return m_Matrix[i, j];
            }

            set
            {
                m_Matrix[i, j] = value;
            }
        }

        public static MatrixInt operator +(MatrixInt a, MatrixInt b)
        {
            int n = a.Size;
            long mod = Math.Max(a.Mod, b.Mod);
            long[,] c = new long[n,n];
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    c[i, j] = a[i, j] + b[i, j];
                }
            }

            if (mod > 0)
            {
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < n; j++)
                    {
                        c[i, j] %= mod;
                    }
                }
            }

            return new MatrixInt(c, mod);
        }

        public static MatrixInt operator *(MatrixInt a, MatrixInt b)
        {
            int n = a.Size;
            long mod = Math.Max(a.Mod, b.Mod);

            long[,] c = new long[n,n];

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    for (int k = 0; k < n; k++)
                    {
                        c[i, j] += a[i, k] * b[k, j];
                        if (mod > 0)
                        {
                            c[i, j] %= mod;
                        }
                    }
                }
            }

            return new MatrixInt(c, mod);
        }

        public void Print()
        {
            for (int i = 0; i < Size; i++)
            {
                for (int j = 0; j < Size; j++)
                {
                    Console.Write("{0} ", m_Matrix[i, j]);
                }
                Console.WriteLine();
            }
        }
    }

    public static class Permutations
    {
        private static readonly Random m_Random;

        static Permutations()
        {
            m_Random = new Random();
        }

        public static int[] GetRandomPermutation(int n)
        {
            int[] p = new int[n];
            for (int i = 0; i < n; i++)
            {
                p[i] = i;
            }

            for (int i = n - 1; i > 0; i--)
            {
                int j = m_Random.Next(i + 1);
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
            }

            return p;
        }

        /*public static T[] Shuffle<T>(this T[] array)
        {
            int length = array.Length;
            int[] p = GetRandomPermutation(length);
            T[] result = new T[length];
            for (int i = 0; i < length; i++)
            {
                result[i] = array[p[i]];
            }

            return result;
        }*/

        /*public static T[] ShuffleSort<T>(this T[] array)
        {
            var result = array.Shuffle();
            Array.Sort(result);
            return result;
        }*/

        public static void Shuffle<T>(T[] array)
        {
            var n = array.Count();
            for (int i = n - 1; i > 0; i--)
            {
                int j = m_Random.Next(i + 1);
                T tmp = array[i];
                array[i] = array[j];
                array[j] = tmp;
            }
        }

        public static void ShuffleSort<T>(T[] array)
        {
            Shuffle(array);
            Array.Sort(array);
        }
    }

    internal static class Algebra
    {
        public static long Phi(long n)
        {
            long result = n;
            for (long i = 2; i * i <= n; i++)
            {
                if (n % i == 0)
                {
                    while (n % i == 0)
                    {
                        n /= i;
                    }

                    result -= result / i;
                }
            }

            if (n > 1)
            {
                result -= result / n;
            }

            return result;
        }

        public static long BinPower(long a, long n, long mod)
        {
            long result = 1;

            while (n > 0)
            {
                if ((n & 1) != 0)
                {
                    result = (result * a) % mod;
                }

                a = (a * a) % mod;
                n >>= 1;
            }

            return result;
        }

        public static MatrixInt MatrixBinPower(MatrixInt a, long n)
        {
            MatrixInt result = MatrixInt.IdentityMatrix(a.Size, a.Mod);

            while (n > 0)
            {
                if ((n & 1) != 0)
                {
                    result *= a;
                }

                a *= a;
                n >>= 1;
            }

            return result;
        }

        public static long Gcd(long a, long b)
        {
            return b == 0 ? a : Gcd(b, a % b);
        }

        public static long ExtendedGcd(long a, long b, out long x, out long y)
        {
            if (b == 0)
            {
                x = 1;
                y = 0;
                return a;
            }

            long x1;
            long y1;
            long d = ExtendedGcd(b, a % b, out x1, out y1);
            x = y1;
            y = x1 - (a / b) * y1;
            return d;
        }

        public static long Lcm(long a, long b)
        {
            return (a / Gcd(a, b)) * b;
        }

        public static bool[] GetPrimes(int n)
        {
            n = Math.Max(n, 2);
            bool[] prime = new bool[n + 1];
            for (int i = 2; i <= n; i++)
            {
                prime[i] = true;
            }

            for (int i = 2; i * i <= n; i++)
            {
                if (prime[i])
                {
                    if ((long)i * i <= n)
                    {
                        for (int j = i * i; j <= n; j += i)
                        {
                            prime[j] = false;
                        }
                    }
                }
            }

            return prime;
        }

        public static long GetFibonacciNumber(long n, long mod = 0)
        {
            long[,] matrix = new long[,] { { 0, 1 }, { 1, 1 } };

            MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);

            return result[1, 1];
        }

        public static long[] GetFibonacciSequence(int n)
        {
            long[] result = new long[n];
            result[0] = result[1] = 1;

            for (int i = 2; i < n; i++)
            {
                result[i] = result[i - 1] + result[i - 2];
            }

            return result;
        }

        public static long GetInverseElement(long a, long mod)
        {
            long x, y;
            long g = ExtendedGcd(a, mod, out x, out y);

            if (g != 1)
            {
                return -1;
            }

            return ((x % mod) + mod) % mod;
        }

        public static long[] GetAllInverseElements(long n, long mod)
        {
            long[] result = new long[n];
            result[1] = 1;
            for (int i = 2; i < n; i++)
            {
                result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;
            }

            return result;
        }

        public static int GetMinimalPrimeDivisor(int n)
        {
            for (int i = 2; i * i <= n; i++)
            {
                if (n % i == 0)
                {
                    return i;
                }
            }

            return n;
        }

        public static long Sqr(long x)
        {
            return x * x;
        }

        public static int SumOfDigits(long x, long baseMod = 10)
        {
            int res = 0;
            while (x > 0)
            {
                res += (int)(x % baseMod);
                x = x / baseMod;
            }
            return res;
        }
    }

    internal static class Reader
    {
        public static void Read<T>(out T v1)
        {
            var values = new T[1];
            Read(values);
            v1 = values[0];
        }

        public static void Read<T>(out T v1, out T v2)
        {
            var values = new T[2];
            Read(values);
            v1 = values[0];
            v2 = values[1];
        }

        public static void Read<T>(out T v1, out T v2, out T v3)
        {
            var values = new T[3];
            Read(values);
            v1 = values[0];
            v2 = values[1];
            v3 = values[2];
        }

        public static void Read<T>(out T v1, out T v2, out T v3, out T v4)
        {
            var values = new T[4];
            Read(values);
            v1 = values[0];
            v2 = values[1];
            v3 = values[2];
            v4 = values[3];
        }

        public static void Read<T>(out T v1, out T v2, out T v3, out T v4, out T v5)
        {
            var values = new T[5];
            Read(values);
            v1 = values[0];
            v2 = values[1];
            v3 = values[2];
            v4 = values[3];
            v5 = values[4];
        }

        public static void Read<T>(T[] values)
        {
            Read(values, values.Length);
        }

        public static void Read<T>(T[] values, int count)
        {
// ReSharper disable PossibleNullReferenceException
            var list = Console.ReadLine().Split();
// ReSharper restore PossibleNullReferenceException

            count = Math.Min(count, list.Length);

            var converter = TypeDescriptor.GetConverter(typeof(T));

            for (int i = 0; i < count; i++)
            {
                values[i] = (T)converter.ConvertFromString(list[i]);
            }
        }

        public static int[] ReadDigits()
        {
            // ReSharper disable AssignNullToNotNullAttribute
            return Console.ReadLine().Select(x => int.Parse(x.ToString(CultureInfo.InvariantCulture))).ToArray();
            // ReSharper restore AssignNullToNotNullAttribute
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }
    }

    public interface IGraph
    {
        bool IsOriented { get; set; }

        int Vertices { get; set; }

        IList<int> this[int i] { get; }

        void AddEdge(int u, int v);

        void AddOrientedEdge(int u, int v);

        void AddNotOrientedEdge(int u, int v);
    }

    public class ListGraph : IGraph
    {
        private readonly List<int>[] m_Edges;

        public int Vertices { get; set; }

        public bool IsOriented { get; set; }

        public IList<int> this[int i]
        {
            get
            {
                return this.m_Edges[i];
            }
        }

        public ListGraph(int vertices, bool isOriented = false)
        {
            this.Vertices = vertices;
            this.IsOriented = isOriented;

            this.m_Edges = new List<int>[vertices];

            for (int i = 0; i < vertices; i++)
            {
                this.m_Edges[i] = new List<int>();
            }
        }

        public void AddEdge(int u, int v)
        {
            this.AddOrientedEdge(u, v);
            if (!IsOriented)
            {
                this.AddOrientedEdge(v, u);
            }
        }

        public void AddNotOrientedEdge(int u, int v)
        {
            this.AddOrientedEdge(u, v);
            this.AddOrientedEdge(v, u);
        }

        public void AddOrientedEdge(int first, int second)
        {
            this.m_Edges[first].Add(second);
        }

        public int[] Bfs(int start)
        {
            int[] d = new int[Vertices];
            for (int i = 0; i < Vertices; i++)
            {
                d[i] = -1;
            }

            Queue<int> queue = new Queue<int>();
            queue.Enqueue(start);
            d[start] = 0;

            while (queue.Count > 0)
            {
                int v = queue.Dequeue();
                foreach (int t in this.m_Edges[v].Where(t => d[t] == -1))
                {
                    queue.Enqueue(t);
                    d[t] = d[v] + 1;
                }
            }

            return d;
        }
    }

    internal class SimpleSumTable
    {
        private readonly int[,] m_Sum;

        public SimpleSumTable(int n, int m, int[,] table)
        {
            m_Sum = new int[n + 1,m + 1];

            for (int i = 1; i < n + 1; i++)
            {
                for (int j = 1; j < m + 1; j++)
                {
                    m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i - 1, j - 1];
                }
            }
        }

        public int GetSum(int l, int b, int r, int t)
        {
            return m_Sum[r + 1, t + 1] - m_Sum[r + 1, b] - m_Sum[l, t + 1] + m_Sum[l, b];
        }
    }

    internal class SegmentTreeSimpleInt<T>
    {
        public int Size { get; private set; }

        private readonly T[] m_Tree;

        private readonly Func<T, T, T> m_Operation;

        private readonly T m_Null;

        public SegmentTreeSimpleInt(int size, Func<T, T, T> operation, T nullElement, IList<T> array = null)
        {
            this.Size = size;
            this.m_Operation = operation;
            this.m_Null = nullElement;

            m_Tree = new T[4 * size];
            if (array != null)
            {
                this.Build(array, 1, 0, size - 1);
            }
        }

        private void Build(IList<T> array, int v, int tl, int tr)
        {
            if (tl == tr)
            {
                m_Tree[v] = array[tl];
            }
            else
            {
                int tm = (tl + tr) / 2;
                this.Build(array, 2 * v, tl, tm);
                this.Build(array, 2 * v + 1, tm + 1, tr);
                this.CalculateNode(v);
            }
        }

        public T GetSum(int l, int r)
        {
            return GetSum(1, 0, Size - 1, l, r);
        }

        private T GetSum(int v, int tl, int tr, int l, int r)
        {
            if (l > r)
            {
                return m_Null;
            }

            if (l == tl && r == tr)
            {
                return m_Tree[v];
            }

            int tm = (tl + tr) / 2;

            return this.m_Operation(
                GetSum(2 * v, tl, tm, l, Math.Min(r, tm)), GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));
        }

        public void Update(int pos, T newValue)
        {
            Update(1, 0, Size - 1, pos, newValue);
        }

        private void Update(int v, int tl, int tr, int pos, T newValue)
        {
            if (tl == tr)
            {
                m_Tree[v] = newValue;
            }
            else
            {
                int tm = (tl + tr) / 2;
                if (pos <= tm)
                {
                    Update(2 * v, tl, tm, pos, newValue);
                }
                else
                {
                    Update(2 * v + 1, tm + 1, tr, pos, newValue);
                }
                this.CalculateNode(v);
            }
        }

        private void CalculateNode(int v)
        {
            m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);
        }
    }

    internal class Pair<TFirst, TSecond>
    {
        public Pair(TFirst first, TSecond second)
        {
            this.First = first;
            this.Second = second;
        }

        public TFirst First { set; get; }

        public TSecond Second { set; get; }

        protected bool Equals(Pair<TFirst, TSecond> other)
        {
            return EqualityComparer<TFirst>.Default.Equals(this.First, other.First) && EqualityComparer<TSecond>.Default.Equals(this.Second, other.Second);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }
            if (ReferenceEquals(this, obj))
            {
                return true;
            }
            if (obj.GetType() != this.GetType())
            {
                return false;
            }
            return Equals((Pair<TFirst, TSecond>)obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return (EqualityComparer<TFirst>.Default.GetHashCode(this.First) * 397) ^ EqualityComparer<TSecond>.Default.GetHashCode(this.Second);
            }
        }
    }

    internal class FenwickTreeInt64
    {
        public FenwickTreeInt64(int size)
        {
            this.m_Size = size;
            m_Tree = new long[size];
        }

        public FenwickTreeInt64(int size, IList<long> tree)
            : this(size)
        {
            for (int i = 0; i < size; i++)
            {
                Inc(i, tree[i]);
            }
        }

        public long Sum(int r)
        {
            long res = 0;
            for (; r >= 0; r = (r & (r + 1)) - 1)
            {
                res += m_Tree[r];
            }
            return res;
        }

        public long Sum(int l, int r)
        {
            return Sum(r) - Sum(l - 1);
        }

        public void Inc(int i, long x)
        {
            for (; i < m_Size; i = i | (i + 1))
            {
                m_Tree[i] += x;
            }
        }

        public void Set(int i, long x)
        {
            Inc(i, x - Sum(i, i));
        }

        private readonly int m_Size;

        private readonly long[] m_Tree;
    }

    internal class AccumulativeDictionary<TKey> : Dictionary<TKey, int>
    {
        public new void Add(TKey key, int value = 1)
        {
            if (this.ContainsKey(key))
            {
                base[key] += value;
            }
            else
            {
                base.Add(key, value);
            }
        }

        public new int this[TKey key]
        {
            get
            {
                return this.ContainsKey(key) ? base[key] : 0;
            }
            set
            {
                this.Add(key, value);
            }
        }
    }

    public class PriorityQueue<T>
    {
        public PriorityQueue(Comparison<T> comparison = null)
        {
            if (comparison == null)
            {
                if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable<T>)))
                {
                    m_Comparison = (a, b) => ((IComparable<T>)a).CompareTo(b);
                }
                else
                {
                    throw new ApplicationException("Add comparer");
                }
            }
            else
            {
                m_Comparison = comparison;
            }
        }

        public int Count { get; private set; }

        public void Enqueue(T item)
        {
            m_List.Add(item);
            m_Indexes.Add(item, this.Count);
            this.Count++;
            Up(this.Count);
        }

        public T Peek()
        {
            return m_List[0];
        }

        public T Dequeue()
        {
            if (this.Count > 0)
            {
                var result = m_List[0];

                Swap(0, this.Count - 1);
                m_Indexes.Remove(m_List[this.Count - 1]);
                m_List.RemoveAt(this.Count - 1);
                this.Count--;
                this.Down(1);

                return result;
            }
            throw new ApplicationException("Couldn't get element from empty queue");
        }

        public void Update(T item)
        {
            int index = m_Indexes[item];
            this.Up(index + 1);
        }

        private readonly List<T> m_List = new List<T>();

        private readonly Dictionary<T, int> m_Indexes = new Dictionary<T, int>();

        private readonly Comparison<T> m_Comparison;

        private void Up(int index)
        {
            while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)
            {
                this.Swap(index - 1, index / 2 - 1);

                index = index / 2;
            }
        }

        private void Down(int index)
        {
            while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0
                   || 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)
            {
                if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)
                {
                    this.Swap(index - 1, 2 * index - 1);
                    index = 2 * index;
                }
                else
                {
                    this.Swap(index - 1, 2 * index);
                    index = 2 * index + 1;
                }
            }
        }

        private void Swap(int i, int j)
        {
            var tmp = m_List[i];
            m_List[i] = m_List[j];
            m_List[j] = tmp;

            m_Indexes[m_List[i]] = i;
            m_Indexes[m_List[j]] = j;
        }
    }

    public class DisjointSetUnion<T>
    {
        public DisjointSetUnion()
        {
            m_Parent = new Dictionary<T, T>();
            m_Rank = new Dictionary<T, int>();
        }

        public DisjointSetUnion(DisjointSetUnion<T> set)
        {
            m_Parent = new Dictionary<T, T>(set.m_Parent);
            m_Rank = new Dictionary<T, int>(set.m_Rank);
        }

        private readonly Dictionary<T, T> m_Parent;
        private readonly Dictionary<T, int> m_Rank;

        public int GetRank(T x)
        {
            return m_Rank[x];
        }

        public void MakeSet(T x)
        {
            m_Parent[x] = x;
            this.m_Rank[x] = 0;
        }

        public void UnionSets(T x, T y)
        {
            x = this.FindSet(x);
            y = this.FindSet(y);
            if (!x.Equals(y))
            {
                if (m_Rank[x] < m_Rank[y])
                {
                    T t = x;
                    x = y;
                    y = t;
                }
                m_Parent[y] = x;
                if (m_Rank[x] == m_Rank[y])
                {
                    m_Rank[x]++;
                }
            }
        }

        public T FindSet(T x)
        {
            if (x.Equals(m_Parent[x]))
            {
                return x;
            }
            return m_Parent[x] = this.FindSet(m_Parent[x]);
        }
    }

    internal class HamiltonianPathFinder
    {
        public static void Run()
        {
            int n, m;
            Reader.Read(out n, out m);
            List<int>[] a = new List<int>[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = new List<int>();
            }
            for (int i = 0; i < m; i++)
            {
                int x, y;
                Reader.Read(out x, out y);
                a[x].Add(y);
                a[y].Add(x);
            }

            var rnd = new Random();

            bool[] v = new bool[n];
            int[] p = new int[n];
            for (int i = 0; i < n; i++)
            {
                p[i] = -1;
            }
            int first = rnd.Next(n);
            int cur = first;
            v[cur] = true;

            int count = 1;

            while (true)
            {
                var unb = a[cur].Where(u => !v[u]).ToList();
                int d = unb.Count;
                if (d > 0)
                {
                    int next = unb[rnd.Next(d)];
                    v[next] = true;
                    p[cur] = next;
                    cur = next;
                    count++;
                }
                else
                {
                    if (count  == n && a[cur].Contains(first))
                    {
                        p[cur] = first;
                        break;
                    }

                    d = a[cur].Count;
                    int pivot;
                    do
                    {
                        pivot = a[cur][rnd.Next(d)];
                    }
                    while (p[pivot] == cur);

                    int next = p[pivot];

                    int x = next;
                    int y = -1;
                    while (true)
                    {
                        int tmp = p[x];
                        p[x] = y;
                        y = x;
                        x = tmp;
                        if (y == cur)
                        {
                            break;
                        }
                    }
                    p[pivot] = cur;
                    cur = next;
                }
            }

            cur = first;
            do
            {
                Console.Write("{0} ", cur);
                cur = p[cur];
            }
            while (cur != first);
        }

        public static void WriteTest(int n)
        {
            Console.WriteLine("{0} {1}", 2 * n, 2 * (n - 1) + n);
            for (int i = 0; i < n - 1; i++)
            {
                Console.WriteLine("{0} {1}", 2 * i, 2 * i + 2);
                Console.WriteLine("{0} {1}", 2 * i + 1, 2 * i + 3);
                //Console.WriteLine("{0} {1}", 2 * i + 1, 2 * i + 2);
                //Console.WriteLine("{0} {1}", 2 * i, 2 * i + 3);
            }
            for (int i = 0; i < n; i++)
            {
                Console.WriteLine("{0} {1}", 2 * i, 2 * i + 1);
            }
        }
    }

    internal class Backtrack<T> where T : class
    {
        public Backtrack(Func<T, IEnumerable<T>> generator)
        {
            this.m_Generator = generator;
        }

        public Dictionary<T, T> Generate(T startState)
        {
            var result = new Dictionary<T, T>();
            result.Add(startState, null);

            var queue = new Queue<T>();
            queue.Enqueue(startState);

            while (queue.Count > 0)
            {
                var current = queue.Dequeue();
                var next = m_Generator(current);
                foreach (var state in next)
                {
                    if (!result.ContainsKey(state))
                    {
                        result[state] = current;
                        queue.Enqueue(state);
                    }
                }
            }

            return result;
        }

        private Func<T, IEnumerable<T>> m_Generator;
    }

    public static class Utility
    {
        public static readonly int[] sx = new[] { 1, 0, -1, 0 };
        public static readonly int[] sy = new[] { 0, 1, 0, -1 };

        public static PointInt[] GenerateNeighbors(long x, long y)
        {
            var result = new PointInt[4];
            for (int i = 0; i < 4; i++)
            {
                result[i] = new PointInt(x + sx[i], y + sy[i]);
            }
            return result;
        }

        public static PointInt[] GenerateNeighbors(this PointInt p)
        {
            return GenerateNeighbors(p.X, p.Y);
        }

        public static List<PointInt> GenerateNeighborsWithBounds(long x, long y, int n, int m)
        {
            var result = new List<PointInt>(4);
            for (int i = 0; i < 4; i++)
            {
                var nx = x + sx[i];
                var ny = y + sy[i];
                if (0 <= nx && nx < n && 0 <= ny && ny < m)
                {
                    result.Add(new PointInt(nx, ny));
                }
            }
            return result;
        }

        public static List<PointInt> GenerateNeighborsWithBounds(this PointInt p, int n, int m)
        {
            return GenerateNeighborsWithBounds(p.X, p.Y, n, m);
        }
    }

    internal class Program
    {
        private static StreamReader m_InputStream;

        private static StreamWriter m_OutStream;

        private static void OpenFiles()
        {
            m_InputStream = new StreamReader("input.txt"); //File.OpenText("input.txt");
            Console.SetIn(m_InputStream);

            m_OutStream = new StreamWriter("output.txt"); //File.CreateText("output.txt");
            Console.SetOut(m_OutStream);
        }

        private static void CloseFiles()
        {
            m_OutStream.Flush();

            m_InputStream.Dispose();
            m_OutStream.Dispose();
        }

        private static void Main()
        {
            //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

            //OpenFiles();

            var mainThread = new Thread(() => new Solution().Solve(), 50 * 1024 * 1024);
            mainThread.Start();
            mainThread.Join();

           // CloseFiles();
        }
    }

    internal class Solution
    {
        public void Solve()
        {
            long x, y, m;
            Reader.Read(out x, out y, out m);

            if (x >= m || y >= m)
            {
                Console.WriteLine(0);
                return;
            }

            if (x <= 0 && y <= 0)
            {
                Console.WriteLine(-1);
                return;
            }

            var max = Math.Max(x, y);
            y = x + y - max;
            x = max;
            long ans = 0;
            if (y <= 0)
            {
                ans = (-y) / x + 1;
                y += ans * x;
            }

            while (x < m)
            {
                var sum = x + y;
                y = x;
                x = sum;
                ans++;
            }

            Console.WriteLine(ans);
        }
    }
}

using System;

public sealed class Program {

  static Int64 Solve() {
    String[] tok = Console.ReadLine().Split(' ');
    Int64 a = Int64.Parse(tok[0]), b = Int64.Parse(tok[1]), m = Int64.Parse(tok[2]), t;
    if (a >= m || b >= m) {
      return 0;
    }
    if (a <= 0 && b <= 0) {
      return -1;
    }
    if (a < b) {
      Swap(ref a, ref b);
    }
    // a >= b
    Int64 add = 0;
    if (a > 0 && b < 0) {
      add = -b / a;
      b += a * add;
    }
    for (Int32 i = 0; i < 100000; ++i) {
      if (a < b) {
        t = a;
        a = b;
        b = t;
      }
      if (a >= m) {
        return i + add;
      }
      b += a;
    }
    return -1;
  }

  public Program() {
    Console.WriteLine(Solve());
  }

  // stuff cutline

  static void Swap<T>(ref T a, ref T b) {
    T t = a;
    a = b;
    b = t;
  }

  static Int32 ReadInt() {
    Boolean neg = false;
    Int32 ch, ans = 0;
    do {
      ch = Console.Read();
      neg |= ch == (Int32)'-';
    } while (!Char.IsDigit((Char)ch));
    do {
      ans = ans * 10 + (ch & 0xf);
      ch = Console.Read();
    } while (Char.IsDigit((Char)ch));
    return neg ? -ans : ans;
  }

  public static void Main() {
#if DEBUG
    Console.SetIn(new System.IO.StreamReader("..\\..\\in.txt"));
#endif
    var root = new Program();
    Console.Out.Flush();
  }

}

using System;
using System.Collections.Generic;
using System.Linq;

namespace Solution {

    class Solution {

        class StdIn {
            int currPos = 0;
            string[] tokens = new string[0];

            private string getNextToken() {
                if (currPos < tokens.Length) return tokens[currPos++];
                currPos = 0;
                tokens = Console.ReadLine().Split(new char[] { ' ', '\t', '\r', '\n' }, StringSplitOptions.RemoveEmptyEntries);
                return tokens[currPos++];
            }

            public int nextInt() {
                return int.Parse(getNextToken());
            }

            public string nextString() {
                return getNextToken();
            }

            public double nextDouble() {
                return double.Parse(getNextToken());
            }

            public long nextLong() {
                return long.Parse(getNextToken());
            }
        }

        public static void swap<T>(ref T a, ref T b) {
            T c = a;
            a = b;
            b = c;
        }

        public static void Main(string[] args) {
            StdIn std = new StdIn();

            long x = std.nextLong();
            long y = std.nextLong();
            long m = std.nextLong();

            if (x >= m || y >= m) {
                Console.WriteLine(0);
                return;
            }
            if (x <= 0 && y <= 0) {
                Console.WriteLine(-1);
                return;
            }

            long ans = 0;
            if (x < 0) {
                ans += (-x) / y;
                x += ans * y;
            }
            if (y < 0) {
                ans += (-y) / x;
                y += ans * x;
            }

            while (x < m && y < m) {
                ++ans;
                if (x < y) x += y;
                else y += x;
            }

            Console.WriteLine(ans);

            //Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
public class Codeforces
{
    protected static TextReader reader;
    protected static TextWriter writer;
    static object Solve()
    {
        var x = ReadLong(); var y = ReadLong(); var m = ReadLong();
        var ctr = 0L;
        if (x >= m || y >= m) { writer.WriteLine(0); return null; }
        if (Math.Max(x, y) <= 0) { if (Math.Max(x, y) >= m) writer.WriteLine(0); else writer.WriteLine(-1); return null; }
        if (y < x) { var temp = x; x = y; y = temp; }
        if (x < 0)
        {
            ctr += Math.Abs(x) / y;
            ctr++;
            x = y * ctr + x;
        }
        while (y < m & x < m)
        {
            if (x < y) x += y;
            else y += x;
            ctr++;
        }
        writer.WriteLine(ctr);
        return null;
    }
    static void Main()
    {
        reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
        try
        {
            object result = Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
            throw;
        }
        reader.Close();
        writer.Close();
    }
    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }
    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }
    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }
    static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c != '-' && (c < '0' || c > '9'));
        int sign = 1;
        if (c == '-')
        {
            sign = -1;
            c = reader.Read();
        }
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res * sign;
            res *= 10;
            res += c - '0';
        }
    }
    #endregion
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Threading;
using System.Numerics;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new System.IO.StreamReader(@"..\..\..\in"));
            Console.SetOut(new System.IO.StreamWriter(@"..\..\..\out"));
            for (int testN = 0; testN < 8; testN++)
            {
#endif
                //SetCulture();
                var x1 = NextLong();
                var y1 = NextLong();
                var m1 = NextLong();
                var x = new BigInteger(x1);
                var y = new BigInteger(y1);
                var m = new BigInteger(m1);
                if (x >= m || y >= m)
                {
                    Console.WriteLine("0");
                }
                else
                {
                    if (m <= 0)
                    {
                        Console.WriteLine("-1");
                    }
                    else if ((x == 0 && y <= 0) || (y == 0 && x <= 0) || (x <= 0 && y <= 0))
                    {
                        Console.WriteLine("-1");
                    }
                    else
                    {
                        var c = new BigInteger(0);
                        if (x < 0)
                        {
                            c += (-x) / y;
                            x += (y) * c;
                        }
                        if (y < 0)
                        {
                            c += (-y) / x;
                            y += (x) * c;
                        }
                        while (x < m && y < m)
                        {
                            c++;
                            if (x >= y)
                            {
                                y += x;
                            }
                            else
                            {
                                x += y;
                            }
                        }
                        Console.WriteLine(c);
                    }
                }
                //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, "{0:F4}", res));
#if !ONLINE_JUDGE
                Console.ReadLine();
            }
            Console.In.Close();
            Console.Out.Close();
#endif
        }

        private static char[] _defaultSplitter = new char[] { ' ', '\t' };

        private static void SetCulture()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        }

        private static char[] ReadChars(int n)
        {
            char[] buffer = new char[n];
            Console.In.ReadBlock(buffer, 0, n);
            return buffer;
        }

        private static string[] ReadAll()
        {
            return Console.In.ReadToEnd().Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords()
        {
            return ReadWords(_defaultSplitter);
        }

        private static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        private static int[] ReadInts(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        private static int[] ReadInts()
        {
            return ReadInts(_defaultSplitter);
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static double ReadDouble()
        {
            return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);
        }

        private static int _pos = 0;
        private static string[] _inputLine = new string[0];

        private static void CheckInputLine()
        {
            if (_pos >= _inputLine.Length)
            {
                _inputLine = ReadWords();
                _pos = 0;
            }
        }

        private static string NextWord()
        {
            CheckInputLine();
            return _inputLine[_pos++];
        }

        private static int NextInt()
        {
            CheckInputLine();
            return int.Parse(_inputLine[_pos++]);
        }

        private static long NextLong()
        {
            CheckInputLine();
            return long.Parse(_inputLine[_pos++]);
        }
    }
}

using System;

namespace PerfectPair
{
    partial class PerfectPair
    {
        static void Main(string[] args)
        {
            long x, y, m, diff, diffX, diffY, temp, min = 0, max = 0, count = 0, diffVal, increment;

            x = NextLong();
            y = NextLong();
            m = NextLong();

            diffX = m - x;
            diffY = m - y;

            min = Math.Min(x, y);
            max = Math.Max(x, y);

            if (max >= m)
                Console.WriteLine(0);
            else if ((min >= 0 && m < 0) || (max <= 0 && m > 0) || (max <= 0 && m > max))
                Console.WriteLine(-1);
            else
            {
                while (true)
                {
                    diff = m - min;

                    if (max < diff)
                    {
                        diffVal = max - min + 1;

                        increment = (diffVal / max);
                        increment += diffVal % max == 0 ? 0 : 1;

                        count += increment;

                        temp = max;
                        max = min + increment * max;
                        min = temp;

                        min = Math.Min(min, max);
                        max = Math.Max(temp, max);
                    }
                    else
                    {
                        if (m - max > 0)
                            count++;

                        Console.WriteLine(count);
                        break;
                    }
                }
            }
        }
    }

    partial class PerfectPair
    {
        static string[] tokens = new string[0];
        static int cur_token = 0;

        static void ReadArray(char sep)
        {
            cur_token = 0;
            tokens = Console.ReadLine().Split(sep);
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int NextInt()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return int.Parse(tokens[cur_token++]);
        }

        static long NextLong()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return long.Parse(tokens[cur_token++]);
        }

        static double NextDouble()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return double.Parse(tokens[cur_token++]);
        }

        static decimal NextDecimal()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return decimal.Parse(tokens[cur_token++]);
        }

        static string NextToken()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return tokens[cur_token++];
        }

        static string ReadLine()
        {
            return Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long   x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            long p=mperfect(x, y, m);

            Console.WriteLine(p);
            Console.ReadLine();

        }

        protected static long mperfect(long x, long y, long m)
        {
            long i = 0;

            if (x >= m || y >= m)
                return 0;
             if (x <= 0 && y <= 0 )
                return -1;

             if (x > y)
             {
                 //x ^= y;
                 //y ^= x;
                 //x ^= y;

                 x = x - y;
                 y = x + y;
                 x = y - x;

             }

                if (x < 0 && y > 0)
                {
                    i = -x / y;
                    x = x + y * i;
                }
                else if (y < 0 && x > 0)
                {
                    i = -y / x;
                    y = y + x * i;
                }

                while (x < m && y < m)
                {
                    if (x < y)
                    {
                        x = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }
                    else
                    {
                        y = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }

                }

                return i;

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long   x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            long p=mperfect(x, y, m);

            Console.WriteLine(p);
            Console.ReadLine();

        }

        protected static long mperfect(long x, long y, long m)
        {
            long i = 0;
            if (x < 0 && y < 0 && ((x < m) && (y < m)))
                return -1;
            else if ((x == 0 && y < 0 && (x < m && y < m)) || ((y == 0) && (x < 0) && (x < m && y < m)))
                return -1;
            else if (x == 0 && y == 0 && y < m)
                return -1;
            if (x >= m || y >= m)
                return 0;
            else
            {
                if (x < 0 && y > 0)
                {
                    i = -x / y;
                    x = x + y * i;
                }
                else if (y < 0 && x > 0)
                {
                    i = -y / x;
                    y = y + x * i;
                }

                while (x < m && y < m)
                {
                    if (x < y)
                    {
                        x = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }
                    else
                    {
                        y = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }

                }

                return i;

            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long   x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            long p=mperfect(x, y, m);

            Console.WriteLine(p);
            Console.ReadLine();
        }

        protected static long mperfect(long x, long y, long m)
        {
            long i = 0;

            if (x >= m || y >= m)
                return 0;
             if (x <= 0 && y <= 0 )
                return -1;

             if (x > y)
             {
                 x ^= y;
                 y ^= x;
                 x ^= y;
             }

                if (x < 0 && y > 0)
                {

                    i = -x / y;
                    x = x + y * i;
                }

                while (x < m && y < m)
                {
                    if (x > y)
                    {
                        x ^= y;
                        y ^= x;
                        x ^= y;
                    }
                        x = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                  }

                return i;

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long   x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            long p=mperfect(x, y, m);

            Console.WriteLine(p);
            Console.ReadLine();

        }

        protected static long mperfect(long x, long y, long m)
        {
            long i = 0;

            if (x >= m || y >= m)
                return 0;
             if (x <= 0 && y <= 0 )
                return -1;

             if (x > y)
             {
                 x ^= y;
                 y ^= x;
                 x ^= y;

            //     x ^= (y ^= (x ^= y));
             }

                if (x < 0 && y > 0)
                {
                    i = -x / y;
                    x = x + y * i;
                }
                else if (y < 0 && x > 0)
                {
                    i = -y / x;
                    y = y + x * i;
                }

                while (x < m && y < m)
                {
                    if (x < y)
                    {
                        x = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }
                    else
                    {
                        y = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }

                }

                return i;

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {

      public static Int64  caculate(Int64 big , Int64 small, Int64 target)
        {
            Int64 start=0, step1=0, next=0;
            if (small < 0)
            {
                 step1 = small / (big * -1);
                if (big * step1 + small < 0)
                {
                    step1++;
                }

                start = small + big * step1 > big ? small + big*step1 : big;
                next = small + big * step1 + big;
            }
            else
            {
                start = big;
                next = small + big;
            }
            while (start < target)
            {
                step1++;
                Int64 tmp = start;
                start = next;
                next = tmp + next;
            }

            return step1;
        }
        static void Main(string[] args)
        {
                string input = Console.ReadLine();

                string[] array = input.Split(' ');
                Int64 x = Int64.Parse(array[0]);
                Int64 y = Int64.Parse(array[1]);
                Int64 m = Int64.Parse(array[2]);

                if (x >= m || y >= m)
                {
                    Console.WriteLine("0");
                }
                else
                {
                    Int64 bigger = x > y ? x : y;
                    Int64 smaller = x > y ? y : x;
                    Int64 sub = bigger - smaller;

                    if (bigger <= 0)
                    {
                        Console.WriteLine("-1");
                    }
                    else
                    {
                        Console.WriteLine(caculate(bigger, smaller, m));
                    }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace prC {
    class Program {
        static void Main(string[] args) {
#if ONLINE_JUDGE
#else

            StreamWriter sw = new StreamWriter("output");
            Console.SetOut(sw);
            Console.SetIn(new StreamReader("input"));
#endif

            string[] ss = Console.ReadLine().Split(' ');
            long x = long.Parse(ss[0]);
            long y = long.Parse(ss[1]);
            long m = long.Parse(ss[2]);
            long ans = 0;
            while (x < m && y < m) {
                long sum = x + y;
                if (sum <= Math.Min(x, y)) {
                    ans = -1;
                    break;
                }
                if (x < y) {
                    long a = x;
                    x = y;
                    y = a;
                }
                if (sum < Math.Max(x, y)) {
                    long a1 = (long)Math.Ceiling(-y / (double)x);
                    long a2 = (long)Math.Ceiling((m - y) / (double)x);
                    if (a1 < a2 && a1 > 0) {
                        ans += a1;
                        y += a1 * x;
                    } else if (a2 < a1 && a2 > 0) {
                        ans += a2;
                        y += a2 * x;
                    }
                } else {
                    if (x < y) x = sum;
                    else y = sum;
                    ans++;
                }
            }

            Console.WriteLine(ans);
#if ONLINE_JUDGE
#else
            sw.Close();
#endif
        }
    }
}

#define Online

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace CF
{
    delegate double F(double x);
    delegate decimal Fdec(decimal x);

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("input.txt");
            StreamWriter sw = new StreamWriter("output.txt");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            C();

#if Online
            Console.ReadLine();
#endif

#if FileIO
            sr.Close();
            sw.Close();
#endif
        }

        static void A()
        {

        }

        static void B()
        {
            string row = ReadLine();
            long ans = 0;
            long[] heavy = new long[row.Length];
            long[] metal = new long[row.Length];
            string h = "heavy";
            string m = "metal";
            for (int i = 0; i < row.Length - 4; i++)
            {
                heavy[i + 4] = heavy[i + 3];
                bool isHeavy = true;
                for (int j = i, z = 0; z < 5; j++, z++)
                {
                    if (row[j] != h[z])
                    {
                        isHeavy = false;
                        break;
                    }
                }
                if (isHeavy)
                    heavy[i + 4]++;
            }
            for (int i = row.Length - 1; i >= 4; i--)
            {
                metal[i - 4] = metal[i - 3];
                bool isMetal = true;
                for (int j = i - 4, z = 0; z < 5; j++, z++)
                {
                    if (row[j] != m[z])
                    {
                        isMetal = false;
                        break;
                    }
                }
                if (isMetal)
                    metal[i - 4]++;
            }
            for (int i = 4; i < row.Length - 4; i++)
            {
                ans += (heavy[i] - heavy[i - 1]) * metal[i + 1];
            }
            Console.WriteLine(ans);
        }

        static void C()
        {
            long x, y, m;
            string[] tokens = ReadArray(' ');
            x = long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);
            long ans = 0;
            if (Math.Max(x, y) >= m)
            {
                Console.WriteLine(0);
                return;
            }
            if (x <= 0 && y <= 0)
            {
                Console.WriteLine(-1);
                return;
            }
            if (x < 0 || y < 0)
            {
                if (x < y)
                {
                    ans += -x / y;
                    x += (-x / y) * y;
                }
                else
                {
                    ans += -y / x;
                    y += (-y / x) * x;
                }
            }
            while (Math.Max(x, y) < m)
            {
                if (x <= y)
                {
                    x += y;
                }
                else
                {
                    y += x;
                }
                ans++;
            }
            Console.WriteLine(ans);
        }

        static void D()
        {

        }

        static void E()
        {

        }

        static void TestGen()
        {

        }

        static string[] ReadArray(char sep)
        {
            return Console.ReadLine().Split(sep);
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static string ReadLine()
        {
            return Console.ReadLine();
        }
    }

    public static class MyMath
    {
        public static long BinPow(long a, long n, long mod)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long GCD(long a, long b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static int GCD(int a, int b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static long LCM(long a, long b)
        {
            return (a * b) / GCD(a, b);
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }
    }

    class Edge
    {
        public int a;
        public int b;
        public int w;

        public Edge(int a, int b, int w)
        {
            this.a = a;
            this.b = b;
            this.w = w;
        }
    }

    class Graph
    {
        public List<int>[] g;
        public int[] color; //0-white, 1-gray, 2-black
        public int[] o; //open
        public int[] c; //close
        public int[] p;
        public int[] d;
        public List<Edge> e;
        public Stack<int> ans = new Stack<int>();
        public Graph(int n)
        {
            g = new List<int>[n + 1];
            for (int i = 0; i <= n; i++)
                g[i] = new List<int>();
            color = new int[n + 1];
            o = new int[n + 1];
            c = new int[n + 1];
            p = new int[n + 1];
            d = new int[n + 1];
        }

        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public bool DFS(int u, ref int time)
        {
            color[u] = gray;
            time++;
            o[u] = time;
            for (int i = 0; i < g[u].Count; i++)
            {
                int v = g[u][i];
                if (color[v] == gray)
                {
                    return true;
                }
                if (color[v] == white)
                {
                    p[v] = u;
                    if (DFS(v, ref time)) return true;
                }
            }
            color[u] = black;
            ans.Push(u);
            c[u] = time;
            time++;
            return false;
        }
    }

    static class GraphUtils
    {
        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public static void BFS(int s, Graph g)
        {
            Queue<int> q = new Queue<int>();
            q.Enqueue(s);
            while (q.Count != 0)
            {
                int u = q.Dequeue();
                for (int i = 0; i < g.g[u].Count; i++)
                {
                    int v = g.g[u][i];
                    if (g.color[v] == white)
                    {
                        g.color[v] = gray;
                        g.d[v] = g.d[u] + 1;
                        g.p[v] = u;
                        q.Enqueue(v);
                    }
                }
                g.color[u] = black;
            }
        }

        public static bool DFS(int u, ref int time, Graph g, Stack<int> st)
        {
            g.color[u] = gray;
            time++;
            g.o[u] = time;
            for (int i = 0; i < g.g[u].Count; i++)
            {
                int v = g.g[u][i];
                if (g.color[v] == gray)
                {
                    return true;
                }
                if (g.color[v] == white)
                {
                    g.p[v] = u;
                    if (DFS(v, ref time, g, st)) return true;
                }
            }
            g.color[u] = black;
            st.Push(u);
            g.c[u] = time;
            time++;
            return false;
        }

        public static void FordBellman(int u, Graph g)
        {
            int n = g.g.Length;
            for (int i = 0; i <= n; i++)
            {
                g.d[i] = int.MaxValue;
                g.p[i] = 0;
            }

            g.d[u] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < g.e.Count; j++)
                {
                    if (g.d[g.e[j].a] != int.MaxValue)
                    {
                        if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])
                        {
                            g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;
                            g.p[g.e[j].b] = g.e[j].a;
                        }
                    }
                }
            }
        }
    }

    static class ArrayUtils
    {
        public static int BinarySearch(int[] a, int val)
        {
            int left = 0;
            int right = a.Length - 1;
            int mid;

            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (val <= a[mid])
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }

            if (a[left] == val)
                return left;
            else
                return -1;
        }

        public static double Bisection(F f, double left, double right, double eps)
        {
            double mid;
            while (right - left > eps)
            {
                mid = left + ((right - left) / 2d);
                if (Math.Sign(f(mid)) != Math.Sign(f(left)))
                    right = mid;
                else
                    left = mid;
            }
            return (left + right) / 2d;
        }

        public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)
        {
            decimal m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3m;
                m2 = r - (r - l) / 3m;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static double TernarySearch(F f, double eps, double l, double r, bool isMax)
        {
            double m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3d;
                m2 = r - (r - l) / 3d;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R, Comparison<T> comp)
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (comp(L[i], R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R, Comparison<T> comp)
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R, comp);
            Merge_Sort(A, q + 1, r, L, R, comp);
            Merge(A, p, q, r, L, R, comp);
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (L[i].CompareTo(R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R);
            Merge_Sort(A, q + 1, r, L, R);
            Merge(A, p, q, r, L, R);
        }

        static void Shake<T>(T[] a)
        {
            Random rnd = new Random(Environment.TickCount);
            T temp;
            int b, c;
            for (int i = 0; i < a.Length; i++)
            {
                b = rnd.Next(0, a.Length);
                c = rnd.Next(0, a.Length);
                temp = a[b];
                a[b] = a[c];
                a[c] = temp;
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
    class Program
    {

        static void Main(string[] args)
        {

            String s = Console.ReadLine();

            char[] c = {' '};

            String[] a = s.Split(c, 3, StringSplitOptions.RemoveEmptyEntries);

            long x = long.Parse(a[0]), tx = x;
            long y = long.Parse(a[1]), ty = y;
            long m = long.Parse(a[2]);

            long ans = 0;

            while (tx < m && ty < m){

                long tempX = tx, tempY = ty;

                if (tx < ty){

                    if (ty != 0){

                        ans += ((ty - tx) / ty + 1);

                        tx = tx + ty * ((ty - tx) / ty + 1);

                    }
                    else {

                        ans = -1;

                        break;

                    }

                }
                else {

                    if (tx != 0){

                        ans += ((tx - ty) / tx + 1);

                        ty = ty + tx * ((tx - ty) / tx + 1);

                    }
                    else {

                        ans = -1;

                        break;

                    }

                }

                if (m - tx >= m - tempX && m - ty >= m - tempY){

                    ans = -1;

                    break;

                }

            }

            Console.WriteLine(ans);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace codegh
{
    class Program
    {
        static void Main(string[] args)
        {
            List<long> mas = Console.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(n => Convert.ToInt64(n)).ToList();
            long k = 0;
            if (Math.Max(mas[0], mas[1]) < mas[2] && mas[0]<=0&&mas[1]<=0)
            {
                Console.WriteLine(-1);
                return;
            }
            if (mas[0] > mas[1])
            {
                long c = mas[0];
                mas[0] = mas[1];
                mas[1] = c;
            }
            if (mas[1] >= mas[2])
            {
                Console.WriteLine(0);
                return;
            }
            if (mas[0]<0)
            {

                if (mas[0] % mas[1] == 0)
                {
                    k += Math.Abs((mas[0] / mas[1]));
                }else
                {
                    k +=Math.Abs( (mas[0] / mas[1]))+1;
                }
                mas[0] += mas[1] * k;
            }
            if (mas[0] + mas[1] > mas[2])
            {
                k -= (Math.Abs(mas[2] - mas[1] - mas[0]) / mas[1]);
            }
            while(Math.Max(mas[0], mas[1]) < mas[2])
            {

                long s = mas[0] + mas[1];
                mas[0] = mas[1];
                mas[1] = s;
                k++;
            }
            Console.WriteLine(k);
           // Console.ReadKey();
        }
    }
}

using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Text;
using System.Text.RegularExpressions;
using System.IO;

public class MonstersValley2
{

    public static void Main()
    {
        string str = Console.ReadLine();
        string[] values = str.Split(' ');
        long x = long.Parse(values[0]);
        long y = long.Parse(values[1]);
        long m = long.Parse(values[2]);

        long ans = 0,a,b;
        if (Math.Max(x, y) >= m)
            { Console.WriteLine(0); }

        else if ((x + y) <= Math.Min(x, y))
            { Console.WriteLine(-1); }
        else
        {
            while ((Math.Max(x, y) < m))
            {
                a = x;
                b = y;
                b = x >= y ? x + y : y;
                a = x > y ? x : x + y;
                ans++;
                x = a;
                y = b;
            }
            Console.WriteLine(ans);
        }

        Console.ReadLine();

    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeForces
{
    class R188_Div2_C
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            long x = long.Parse(s[0]);
            long y = long.Parse(s[1]);
            long m = long.Parse(s[2]);

            long x2 = x;
            long y2 = y;
            long cnt = 0, sum;
            while (x2 < m && y2 < m && (x2+y2 > 0))
            {
                sum = x2 + y2;
                if (x2 < y2)
                    x2 = sum;
                else
                    y2 = sum;
                cnt++;
            }
            if (x2 < m && y2 < m)
                Console.WriteLine(-1);
            else
                Console.WriteLine(cnt);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeForces
{
    class R188_Div2_C
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            long x = long.Parse(s[0]);
            long y = long.Parse(s[1]);
            long m = long.Parse(s[2]);

            long x2 = x;
            long y2 = y;
            long cnt = 0, sum;
            if (x2 + y2 <= 0)
            {
                if (x2 < m && y2 < m)
                    Console.WriteLine(-1);
                else
                    Console.WriteLine(0);
            }
            else
            {
                while (x2 < m && y2 < m)
                {
                    sum = x2 + y2;
                    if (x2 < y2)
                        x2 = sum;
                    else
                        y2 = sum;
                    cnt++;
                }
                Console.WriteLine(cnt);
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace CodeForces
{
    class R188_Div2_C
    {
        static void Main(string[] args)
        {
            string[] s = Console.ReadLine().Split();
            long x = long.Parse(s[0]);
            long y = long.Parse(s[1]);
            long m = long.Parse(s[2]);

            long x2 = x;
            long y2 = y;
            long cnt = 0, sum;
            while (x2 < m && y2 < m && ((x2>=0 || y2>=0) && (x2!=0 && y2!=0)))
            {
                sum = x2 + y2;
                if (x2 < y2)
                    x2 = sum;
                else
                    y2 = sum;
                cnt++;
            }
            if (x2 < m && y2 < m)
                Console.WriteLine(-1);
            else
                Console.WriteLine(cnt);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
	class C
	{
		static void Main(string[] args)
		{
		  string[] token = Console.ReadLine().Split();

		  long x = long.Parse(token[0]);
		  long y = long.Parse(token[1]);
		  long m = long.Parse(token[2]);

		  if(x>=m||y>=m)
		  {
		     Console.WriteLine(0);
		     return;
		  }
		  if(x<=0&&y<=0)
		  {
		     Console.WriteLine(-1);
		     return;
		  }
		  long count = 0;
		  if(x < 0)
		  {
		     count = (Math.Abs(x)/y);
		     if(Math.Abs(x)%y==0){
		      x = 0;
		     }else{
		      x = ((count+1)*x)-y;
		      count--;
		     }
		  }else if(y < 0){
		     if(Math.Abs(y)%x==0){
		      y = 0;
		     }else{
		        y = ((count+1)*y)-x;
		         count--;
		     }
		  }
		  while(x<m && y<m)
		  {
		     if(x<y)
		     {
		        x = x + y;
		     }else
		     {
		        y = x + y;
		     }
		     count++;
		  }

		  Console.WriteLine(count);
		}

	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
	class C
	{
		static void Main(string[] args)
		{
		  string[] token = Console.ReadLine().Split();

		  long x = long.Parse(token[0]);
		  long y = long.Parse(token[1]);
		  long m = long.Parse(token[2]);

		  if(x>=m||y>=m)
		  {
		     Console.WriteLine(0);
		     return;
		  }
		  if(x<=0&&y<=0)
		  {
		     Console.WriteLine(-1);
		     return;
		  }
		  long count = 0;
		  if(x<0)
		  {
		     count = Math.Abs(x)/y;
		     x = 0;
		  }else if(y<0){
		     count = Math.Abs(y)/x;
		     y = 0;
		  }
		  while(x<m && y<m)
		  {
		     if(x<y)
		     {
		        x = x + y;
		     }else
		     {
		        y = x + y;
		     }
		     count++;
		  //   Console.WriteLine(x + " ad " + y);
		  }

		  Console.WriteLine(count);
		}

	}
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace CodeForces
{
	class C
	{
		static void Main(string[] args)
		{
		  string[] token = Console.ReadLine().Split();

		  long x = long.Parse(token[0]);
		  long y = long.Parse(token[1]);
		  long m = long.Parse(token[2]);

		  if(x>=m||y>=m)
		  {
		     Console.WriteLine(0);
		     return;
		  }
		  if(x<=0&&y<=0)
		  {
		     Console.WriteLine(-1);
		     return;
		  }
		  long count = 0;
		  if(x < 0)
		  {
		     count = (Math.Abs(x)/y);
		     if(Math.Abs(x)%y==0){
		      x = 0;
		     }else{
		      x = ((count+1)*x)-y;
		      count--;
		     }
		  }else if(y < 0){
		     count = (Math.Abs(y)/x);
		     if(Math.Abs(y)%x==0){
		      y = 0;
		     }else{
		        y = ((count+1)*y)-x;
		        count--;
		     }
		  }
		  while(x<m && y<m)
		  {
		     if(x<y)
		     {
		        x = x + y;
		     }else
		     {
		        y = x + y;
		     }
		     count++;
		  }

		  Console.WriteLine(count);
		}

	}
}

using System;
class Program
    {
        static void Main(string[] args)
        {
            long a, b, c;
            {
                string[] input = Console.ReadLine().Split(new char[] {'\t', ' ' },StringSplitOptions.RemoveEmptyEntries);
                a = long.Parse(input[0]); b = long.Parse(input[1]);
                if(a>b) { c = a; a = b; b = c; }
                c = long.Parse(input[2]);
            }
            if (b<c && a<=0L && b<=0L) Console.WriteLine("-1");
            else
            {
                long counter = 0L;
                if(c>b)
                {
                    long temp = Math.Abs(a);
                    if (temp >= b && b>a)
                    {
                        counter += ((temp / b) + (temp % b > 0L ? 1L : 0L));
                        a += b * counter;
                    }
                    while (b < c)
                    {
                        counter++;
                        a += b;
                        temp = b;
                        b = a;
                        a = temp;
                    }
                }
                Console.WriteLine(counter);
            }
        }
    }

using System;
class Program
    {
        static void Main(string[] args)
        {
            long a, b, c;
            {
                string[] input = Console.ReadLine().Split(new char[] {'\t', ' ' },StringSplitOptions.RemoveEmptyEntries);
                a = long.Parse(input[0]); b = long.Parse(input[1]);
                if(a>b) { c = a; a = b; b = c; }
                c = long.Parse(input[2]);
            }
            if (b<c && a<=0L && b<=0L) Console.WriteLine("-1");
            else
            {
                long counter = 0L;
                if(c>b)
                {
                    long temp = Math.Abs(a);
                    if (temp > b)
                        counter += ((temp / b) + (temp % b > 0L ? 1L : 0L));

                    while (b < c)
                    {
                        counter++;
                        a += b;
                        temp = b;
                        b = a;
                        a = temp;
                    }
                }
                Console.WriteLine(counter);
            }
        }
    }

using System;
class Program
    {
        static void Main(string[] args)
        {
            long a, b, c;
            {
                string[] input = Console.ReadLine().Split(new char[] {'\t', ' ' },StringSplitOptions.RemoveEmptyEntries);
                a = long.Parse(input[0]); b = long.Parse(input[1]);
                if(a>b) { c = a; a = b; b = c; }
                c = long.Parse(input[2]);
            }
            if (Math.Abs(a)>b) Console.WriteLine("-1");
            else
            {
                int counter = 0;

                if (b < c)
                {
                    counter++;
                    long temp = (a += b);
                    a = b;
                    b = temp;
                    while (b < c)
                    {
                        temp = (a += b);
                        a = b;
                        b = temp;
                        counter++;
                    }
                }
                Console.WriteLine(counter);
            }
        }
    }

using System;
 class Program
    {
        static void Main(string[] args)
        {
            long a, b, c;
            {
                string[] input = Console.ReadLine().Split(new char[] {'\t', ' ' },StringSplitOptions.RemoveEmptyEntries);
                a = long.Parse(input[0]); b = long.Parse(input[1]);
                if(a>b) { c = a; a = b; b = c; }
                c = long.Parse(input[2]);
            }
            if (b<c && a<=0L && b<=0L) Console.WriteLine("-1");
            else
            {
                long counter = 0L;
                if(c>b)
                {
                    long temp = Math.Abs(a);
                    if (temp > b)
                    {
                        counter += ((temp / b) + (temp % b > 0L ? 1L : 0L));
                        a += b * counter;
                    }
                    while (b < c)
                    {
                        counter++;
                        a += b;
                        temp = b;
                        b = a;
                        a = temp;
                    }
                }
                Console.WriteLine(counter);
            }
        }
    }

using System;
class Program
    {
        static void Main(string[] args)
        {
            long a, b, c;
            {
                string[] input = Console.ReadLine().Split(new char[] {'\t', ' ' },StringSplitOptions.RemoveEmptyEntries);
                a = long.Parse(input[0]); b = long.Parse(input[1]);
                if(a>b) { c = a; a = b; b = c; }
                c = long.Parse(input[2]);
            }
            if (b<c && a<=0L && b<=0L) Console.WriteLine("-1");
            else
            {
                long counter = 0L;
                long temp = Math.Abs(a);
                if(temp>b)
                  counter += ((temp / b)+(temp%b>0L?1L:0L));

                while (b < c)
                {
                    counter++;
                    a += b;
                    temp = b;
                    b = a;
                    a = temp;
                }
                Console.WriteLine(counter);
            }
        }
    }

using System;
class Program
    {
        static void Main(string[] args)
        {
            long a, b, c;
            {
                string[] input = Console.ReadLine().Split(new char[] {'\t', ' ' },StringSplitOptions.RemoveEmptyEntries);
                a = long.Parse(input[0]); b = long.Parse(input[1]);
                if(a>b) { c = a; a = b; b = c; }
                c = long.Parse(input[2]);
            }
            if (Math.Abs(a)>b && b<c) Console.WriteLine("-1");
            else
            {
                int counter = 0;

                if (b < c)
                {
                    counter++;
                    long temp = (a += b);
                    a = b;
                    b = temp;
                    while (b < c)
                    {
                        temp = (a += b);
                        a = b;
                        b = temp;
                        counter++;
                    }
                }
                Console.WriteLine(counter);
            }
        }
    }

using System;
 class Program
    {
        static void Main(string[] args)
        {
            //string[] input = Console.ReadLine().Split(new char[] { ' ', '\r', '\t', '\n' }, StringSplitOptions.RemoveEmptyEntries);
            long a, b, c;
            {
                string[] input = Console.ReadLine().Split(new char[] {'\t', ' ' },StringSplitOptions.RemoveEmptyEntries);
                a = long.Parse(input[0]); b = long.Parse(input[1]);
                if(a>b) { c = a; a = b; b = c; }
                c = long.Parse(input[2]);
            }
            if (b<c && a<=0 && b<=0) Console.WriteLine("-1");
            else
            {
                int counter = 0;
                long temp;
                while (b < c)
                {
                    counter++;
                    a += b;
                    if(a>b)
                    {
                        temp = b;
                        b = a;
                        a = b;
                    }
                }
                Console.WriteLine(counter);
            }
        }
    }

using System;
class Program
    {
        static void Main(string[] args)
        {
            long a, b, c;
            {
                string[] input = Console.ReadLine().Split(new char[] {'\t', ' ' },StringSplitOptions.RemoveEmptyEntries);
                a = long.Parse(input[0]); b = long.Parse(input[1]);
                if(a>b) { c = a; a = b; b = c; }
                c = long.Parse(input[2]);
            }
            if (b<c && a<=0L && b<=0L) Console.WriteLine("-1");
            else
            {
                long counter = 0L;
                if(c>b)
                {
                    long temp = Math.Abs(a);
                    if (temp >= b)
                    {
                        counter += ((temp / b) + (temp % b > 0L ? 1L : 0L));
                        a += b * counter;
                    }
                    while (b < c)
                    {
                        counter++;
                        a += b;
                        temp = b;
                        b = a;
                        a = temp;
                    }
                }
                Console.WriteLine(counter);
            }
        }
    }

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace tmp11
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] inp = Console.ReadLine().Split(' ');
            double l = Convert.ToDouble(inp[0]);
            double r = Convert.ToDouble(inp[1]);
            double m = Convert.ToDouble(inp[2]);
            double delta, deltal;
            delta = m - (l + r);
            deltal = delta;

            int steps = 0;
            while (true)
            {
                if (l >= m || r >= m)
                {
                    Console.WriteLine(steps);
                    return;
                }

                if (l > r)
                {
                    r += l;
                }
                else
                {
                    l += r;
                }
                delta = m - (l + r);
                if (delta - deltal >= 0)
                {
                    Console.WriteLine(-1);
                    return;
                }
                deltal = delta;
                steps++;
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace tmp11
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] inp = Console.ReadLine().Split(' ');
            double l = Convert.ToDouble(inp[0]);
            double r = Convert.ToDouble(inp[1]);
            double m = Convert.ToDouble(inp[2]);
            double delta, deltal;
            delta = m - l + r;
            deltal = delta;

            int steps = 0;
            while (true)
            {

                if (l > r)
                {
                    r += l;
                }
                else
                {
                    l += r;
                }
                delta = m - (l + r);
                if (delta - deltal >= 0)
                {
                    Console.WriteLine(-1);
                    return;
                }
                deltal = delta;
                steps++;
                if (l >= m || r >= m)
                {
                    Console.WriteLine(steps);
                    return;
                }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace tmp11
{
    class Program
    {
        static void Main(string[] args)
        {
            string[] inp = Console.ReadLine().Split(' ');
            long l = Convert.ToInt64(inp[0]);
            long r = Convert.ToInt64(inp[1]);
            long m = Convert.ToInt64(inp[2]);
            long delta, deltal;
            delta = m - (l + r);
            deltal = delta;

            long steps = 0;
            if (l < 0 && r > 0)
            {
                steps = Math.Abs(l / r);
                l += r * steps;
            }
            while (true)
            {
                if (l >= m || r >= m)
                {
                    Console.WriteLine(steps);
                    return;
                }

                if (l > r)
                {
                    r += l;
                }
                else
                {
                    l += r;
                }
                delta = m - (l + r);
                if (delta - deltal >= 0)
                {
                    Console.WriteLine(-1);
                    return;
                }
                deltal = delta;
                steps++;
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Threading;

namespace Temp
{
    public class PointInt
    {
        public long X;

        public long Y;

        public PointInt(long x, long y)
        {
            this.X = x;
            this.Y = y;
        }

        public PointInt(PointInt head)
            : this(head.X, head.Y)
        {
        }

        public static PointInt operator +(PointInt a, PointInt b)
        {
            return new PointInt(a.X + b.X, a.Y + b.Y);
        }

        public static PointInt operator -(PointInt a, PointInt b)
        {
            return new PointInt(a.X - b.X, a.Y - b.Y);
        }

        public static PointInt operator *(PointInt a, long k)
        {
            return new PointInt(k * a.X, k * a.Y);
        }

        public static PointInt operator *(long k, PointInt a)
        {
            return new PointInt(k * a.X, k * a.Y);
        }

        public bool IsInsideRectangle(long l, long b, long r, long t)
        {
            return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);
        }

        public bool Equals(PointInt other)
        {
            if (ReferenceEquals(null, other))
            {
                return false;
            }
            if (ReferenceEquals(this, other))
            {
                return true;
            }
            return other.X == this.X && other.Y == this.Y;
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }
            if (ReferenceEquals(this, obj))
            {
                return true;
            }
            if (obj.GetType() != typeof(PointInt))
            {
                return false;
            }
            return Equals((PointInt)obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return (this.X.GetHashCode() * 397) ^ this.Y.GetHashCode();
            }
        }
    }

    public class Point2DReal
    {
        public double X;

        public double Y;

        public Point2DReal(double x, double y)
        {
            this.X = x;
            this.Y = y;
        }

        public Point2DReal(Point2DReal head)
            : this(head.X, head.Y)
        {
        }

        public static Point2DReal operator +(Point2DReal a, Point2DReal b)
        {
            return new Point2DReal(a.X + b.X, a.Y + b.Y);
        }

        public static Point2DReal operator -(Point2DReal a, Point2DReal b)
        {
            return new Point2DReal(a.X - b.X, a.Y - b.Y);
        }

        public static Point2DReal operator *(Point2DReal a, double k)
        {
            return new Point2DReal(k * a.X, k * a.Y);
        }

        public static Point2DReal operator *(double k, Point2DReal a)
        {
            return new Point2DReal(k * a.X, k * a.Y);
        }

        public double Dist(Point2DReal p)
        {
            return Math.Sqrt((p.X - X)*(p.X - X) + (p.Y - Y)*(p.Y - Y));
        }

        public bool IsInsideRectangle(double l, double b, double r, double t)
        {
            return (l <= X) && (X <= r) && (b <= Y) && (Y <= t);
        }
    }

    internal class LineInt
    {
        public LineInt(PointInt a, PointInt b)
        {
            A = a.Y - b.Y;
            B = b.X - a.X;
            C = a.X * b.Y - a.Y * b.X;
        }

        public long A, B, C;

        public bool ContainsPoint(PointInt p)
        {
            return A * p.X + B * p.Y + C == 0;
        }

        public int Sign(PointInt p)
        {
            return Math.Sign(A * p.X + B * p.Y + C);
        }
    }

    internal static class Geometry
    {
        public static long VectInt(PointInt a, PointInt b)
        {
            return a.X * b.Y - a.Y * b.X;
        }

        public static long VectInt(PointInt a, PointInt b, PointInt c)
        {
            return (b.X - a.X) * (c.Y - a.Y) - (b.Y - a.Y) * (c.X - a.X);
        }
    }

    internal class MatrixInt
    {
        private readonly long[,] m_Matrix;

        public int Size
        {
            get
            {
                return m_Matrix.GetLength(0);
            }
        }

        public long Mod { get; private set; }

        public MatrixInt(int size, long mod = 0)
        {
            m_Matrix = new long[size,size];
            Mod = mod;
        }

        public MatrixInt(long[,] matrix, long mod = 0)
        {
            var size = matrix.GetLength(0);
            m_Matrix = new long[size,size];
            Array.Copy(matrix, m_Matrix, size * size);
            Mod = mod;

            if (mod != 0)
            {
                for (int i = 0; i < size; i++)
                {
                    for (int j = 0; j < size; j++)
                    {
                        m_Matrix[i, j] %= mod;
                    }
                }
            }
        }

        public static MatrixInt IdentityMatrix(int size, long mod = 0)
        {
            long[,] matrix = new long[size,size];

            for (int i = 0; i < size; i++)
            {
                matrix[i, i] = 1;
            }

            return new MatrixInt(matrix, mod);
        }

        public long this[int i, int j]
        {
            get
            {
                return m_Matrix[i, j];
            }

            set
            {
                m_Matrix[i, j] = value;
            }
        }

        public static MatrixInt operator +(MatrixInt a, MatrixInt b)
        {
            int n = a.Size;
            long mod = Math.Max(a.Mod, b.Mod);
            long[,] c = new long[n,n];
            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    c[i, j] = a[i, j] + b[i, j];
                }
            }

            if (mod > 0)
            {
                for (int i = 0; i < n; i++)
                {
                    for (int j = 0; j < n; j++)
                    {
                        c[i, j] %= mod;
                    }
                }
            }

            return new MatrixInt(c, mod);
        }

        public static MatrixInt operator *(MatrixInt a, MatrixInt b)
        {
            int n = a.Size;
            long mod = Math.Max(a.Mod, b.Mod);

            long[,] c = new long[n,n];

            for (int i = 0; i < n; i++)
            {
                for (int j = 0; j < n; j++)
                {
                    for (int k = 0; k < n; k++)
                    {
                        c[i, j] += a[i, k] * b[k, j];
                        if (mod > 0)
                        {
                            c[i, j] %= mod;
                        }
                    }
                }
            }

            return new MatrixInt(c, mod);
        }

        public void Print()
        {
            for (int i = 0; i < Size; i++)
            {
                for (int j = 0; j < Size; j++)
                {
                    Console.Write("{0} ", m_Matrix[i, j]);
                }
                Console.WriteLine();
            }
        }
    }

    public static class Permutations
    {
        private static readonly Random m_Random;

        static Permutations()
        {
            m_Random = new Random();
        }

        public static int[] GetRandomPermutation(int n)
        {
            int[] p = new int[n];
            for (int i = 0; i < n; i++)
            {
                p[i] = i;
            }

            for (int i = n - 1; i > 0; i--)
            {
                int j = m_Random.Next(i + 1);
                int tmp = p[i];
                p[i] = p[j];
                p[j] = tmp;
            }

            return p;
        }

        /*public static T[] Shuffle<T>(this T[] array)
        {
            int length = array.Length;
            int[] p = GetRandomPermutation(length);
            T[] result = new T[length];
            for (int i = 0; i < length; i++)
            {
                result[i] = array[p[i]];
            }

            return result;
        }*/

        /*public static T[] ShuffleSort<T>(this T[] array)
        {
            var result = array.Shuffle();
            Array.Sort(result);
            return result;
        }*/

        public static void Shuffle<T>(T[] array)
        {
            var n = array.Count();
            for (int i = n - 1; i > 0; i--)
            {
                int j = m_Random.Next(i + 1);
                T tmp = array[i];
                array[i] = array[j];
                array[j] = tmp;
            }
        }

        public static void ShuffleSort<T>(T[] array)
        {
            Shuffle(array);
            Array.Sort(array);
        }
    }

    internal static class Algebra
    {
        public static long Phi(long n)
        {
            long result = n;
            for (long i = 2; i * i <= n; i++)
            {
                if (n % i == 0)
                {
                    while (n % i == 0)
                    {
                        n /= i;
                    }

                    result -= result / i;
                }
            }

            if (n > 1)
            {
                result -= result / n;
            }

            return result;
        }

        public static long BinPower(long a, long n, long mod)
        {
            long result = 1;

            while (n > 0)
            {
                if ((n & 1) != 0)
                {
                    result = (result * a) % mod;
                }

                a = (a * a) % mod;
                n >>= 1;
            }

            return result;
        }

        public static MatrixInt MatrixBinPower(MatrixInt a, long n)
        {
            MatrixInt result = MatrixInt.IdentityMatrix(a.Size, a.Mod);

            while (n > 0)
            {
                if ((n & 1) != 0)
                {
                    result *= a;
                }

                a *= a;
                n >>= 1;
            }

            return result;
        }

        public static long Gcd(long a, long b)
        {
            return b == 0 ? a : Gcd(b, a % b);
        }

        public static long ExtendedGcd(long a, long b, out long x, out long y)
        {
            if (b == 0)
            {
                x = 1;
                y = 0;
                return a;
            }

            long x1;
            long y1;
            long d = ExtendedGcd(b, a % b, out x1, out y1);
            x = y1;
            y = x1 - (a / b) * y1;
            return d;
        }

        public static long Lcm(long a, long b)
        {
            return (a / Gcd(a, b)) * b;
        }

        public static bool[] GetPrimes(int n)
        {
            n = Math.Max(n, 2);
            bool[] prime = new bool[n + 1];
            for (int i = 2; i <= n; i++)
            {
                prime[i] = true;
            }

            for (int i = 2; i * i <= n; i++)
            {
                if (prime[i])
                {
                    if ((long)i * i <= n)
                    {
                        for (int j = i * i; j <= n; j += i)
                        {
                            prime[j] = false;
                        }
                    }
                }
            }

            return prime;
        }

        public static long GetFibonacciNumber(long n, long mod = 0)
        {
            long[,] matrix = new long[,] { { 0, 1 }, { 1, 1 } };

            MatrixInt result = MatrixBinPower(new MatrixInt(matrix, mod), n);

            return result[1, 1];
        }

        public static long[] GetFibonacciSequence(int n)
        {
            long[] result = new long[n];
            result[0] = result[1] = 1;

            for (int i = 2; i < n; i++)
            {
                result[i] = result[i - 1] + result[i - 2];
            }

            return result;
        }

        public static long GetInverseElement(long a, long mod)
        {
            long x, y;
            long g = ExtendedGcd(a, mod, out x, out y);

            if (g != 1)
            {
                return -1;
            }

            return ((x % mod) + mod) % mod;
        }

        public static long[] GetAllInverseElements(long n, long mod)
        {
            long[] result = new long[n];
            result[1] = 1;
            for (int i = 2; i < n; i++)
            {
                result[i] = (mod - (((mod / i) * result[mod % i]) % mod)) % mod;
            }

            return result;
        }

        public static int GetMinimalPrimeDivisor(int n)
        {
            for (int i = 2; i * i <= n; i++)
            {
                if (n % i == 0)
                {
                    return i;
                }
            }

            return n;
        }

        public static long Sqr(long x)
        {
            return x * x;
        }

        public static int SumOfDigits(long x, long baseMod = 10)
        {
            int res = 0;
            while (x > 0)
            {
                res += (int)(x % baseMod);
                x = x / baseMod;
            }
            return res;
        }
    }

    internal static class Reader
    {
        public static void Read<T>(out T v1)
        {
            var values = new T[1];
            Read(values);
            v1 = values[0];
        }

        public static void Read<T>(out T v1, out T v2)
        {
            var values = new T[2];
            Read(values);
            v1 = values[0];
            v2 = values[1];
        }

        public static void Read<T>(out T v1, out T v2, out T v3)
        {
            var values = new T[3];
            Read(values);
            v1 = values[0];
            v2 = values[1];
            v3 = values[2];
        }

        public static void Read<T>(out T v1, out T v2, out T v3, out T v4)
        {
            var values = new T[4];
            Read(values);
            v1 = values[0];
            v2 = values[1];
            v3 = values[2];
            v4 = values[3];
        }

        public static void Read<T>(out T v1, out T v2, out T v3, out T v4, out T v5)
        {
            var values = new T[5];
            Read(values);
            v1 = values[0];
            v2 = values[1];
            v3 = values[2];
            v4 = values[3];
            v5 = values[4];
        }

        public static void Read<T>(T[] values)
        {
            Read(values, values.Length);
        }

        public static void Read<T>(T[] values, int count)
        {
// ReSharper disable PossibleNullReferenceException
            var list = Console.ReadLine().Split();
// ReSharper restore PossibleNullReferenceException

            count = Math.Min(count, list.Length);

            var converter = TypeDescriptor.GetConverter(typeof(T));

            for (int i = 0; i < count; i++)
            {
                values[i] = (T)converter.ConvertFromString(list[i]);
            }
        }

        public static int[] ReadDigits()
        {
            // ReSharper disable AssignNullToNotNullAttribute
            return Console.ReadLine().Select(x => int.Parse(x.ToString(CultureInfo.InvariantCulture))).ToArray();
            // ReSharper restore AssignNullToNotNullAttribute
        }

        public static string ReadLine()
        {
            return Console.ReadLine();
        }
    }

    public interface IGraph
    {
        bool IsOriented { get; set; }

        int Vertices { get; set; }

        IList<int> this[int i] { get; }

        void AddEdge(int u, int v);

        void AddOrientedEdge(int u, int v);

        void AddNotOrientedEdge(int u, int v);
    }

    public class ListGraph : IGraph
    {
        private readonly List<int>[] m_Edges;

        public int Vertices { get; set; }

        public bool IsOriented { get; set; }

        public IList<int> this[int i]
        {
            get
            {
                return this.m_Edges[i];
            }
        }

        public ListGraph(int vertices, bool isOriented = false)
        {
            this.Vertices = vertices;
            this.IsOriented = isOriented;

            this.m_Edges = new List<int>[vertices];

            for (int i = 0; i < vertices; i++)
            {
                this.m_Edges[i] = new List<int>();
            }
        }

        public void AddEdge(int u, int v)
        {
            this.AddOrientedEdge(u, v);
            if (!IsOriented)
            {
                this.AddOrientedEdge(v, u);
            }
        }

        public void AddNotOrientedEdge(int u, int v)
        {
            this.AddOrientedEdge(u, v);
            this.AddOrientedEdge(v, u);
        }

        public void AddOrientedEdge(int first, int second)
        {
            this.m_Edges[first].Add(second);
        }

        public int[] Bfs(int start)
        {
            int[] d = new int[Vertices];
            for (int i = 0; i < Vertices; i++)
            {
                d[i] = -1;
            }

            Queue<int> queue = new Queue<int>();
            queue.Enqueue(start);
            d[start] = 0;

            while (queue.Count > 0)
            {
                int v = queue.Dequeue();
                foreach (int t in this.m_Edges[v].Where(t => d[t] == -1))
                {
                    queue.Enqueue(t);
                    d[t] = d[v] + 1;
                }
            }

            return d;
        }
    }

    internal class SimpleSumTable
    {
        private readonly int[,] m_Sum;

        public SimpleSumTable(int n, int m, int[,] table)
        {
            m_Sum = new int[n + 1,m + 1];

            for (int i = 1; i < n + 1; i++)
            {
                for (int j = 1; j < m + 1; j++)
                {
                    m_Sum[i, j] = m_Sum[i, j - 1] + m_Sum[i - 1, j] - m_Sum[i - 1, j - 1] + table[i - 1, j - 1];
                }
            }
        }

        public int GetSum(int l, int b, int r, int t)
        {
            return m_Sum[r + 1, t + 1] - m_Sum[r + 1, b] - m_Sum[l, t + 1] + m_Sum[l, b];
        }
    }

    internal class SegmentTreeSimpleInt<T>
    {
        public int Size { get; private set; }

        private readonly T[] m_Tree;

        private readonly Func<T, T, T> m_Operation;

        private readonly T m_Null;

        public SegmentTreeSimpleInt(int size, Func<T, T, T> operation, T nullElement, IList<T> array = null)
        {
            this.Size = size;
            this.m_Operation = operation;
            this.m_Null = nullElement;

            m_Tree = new T[4 * size];
            if (array != null)
            {
                this.Build(array, 1, 0, size - 1);
            }
        }

        private void Build(IList<T> array, int v, int tl, int tr)
        {
            if (tl == tr)
            {
                m_Tree[v] = array[tl];
            }
            else
            {
                int tm = (tl + tr) / 2;
                this.Build(array, 2 * v, tl, tm);
                this.Build(array, 2 * v + 1, tm + 1, tr);
                this.CalculateNode(v);
            }
        }

        public T GetSum(int l, int r)
        {
            return GetSum(1, 0, Size - 1, l, r);
        }

        private T GetSum(int v, int tl, int tr, int l, int r)
        {
            if (l > r)
            {
                return m_Null;
            }

            if (l == tl && r == tr)
            {
                return m_Tree[v];
            }

            int tm = (tl + tr) / 2;

            return this.m_Operation(
                GetSum(2 * v, tl, tm, l, Math.Min(r, tm)), GetSum(2 * v + 1, tm + 1, tr, Math.Max(l, tm + 1), r));
        }

        public void Update(int pos, T newValue)
        {
            Update(1, 0, Size - 1, pos, newValue);
        }

        private void Update(int v, int tl, int tr, int pos, T newValue)
        {
            if (tl == tr)
            {
                m_Tree[v] = newValue;
            }
            else
            {
                int tm = (tl + tr) / 2;
                if (pos <= tm)
                {
                    Update(2 * v, tl, tm, pos, newValue);
                }
                else
                {
                    Update(2 * v + 1, tm + 1, tr, pos, newValue);
                }
                this.CalculateNode(v);
            }
        }

        private void CalculateNode(int v)
        {
            m_Tree[v] = this.m_Operation(m_Tree[2 * v], m_Tree[2 * v + 1]);
        }
    }

    internal class Pair<TFirst, TSecond>
    {
        public Pair(TFirst first, TSecond second)
        {
            this.First = first;
            this.Second = second;
        }

        public TFirst First { set; get; }

        public TSecond Second { set; get; }

        protected bool Equals(Pair<TFirst, TSecond> other)
        {
            return EqualityComparer<TFirst>.Default.Equals(this.First, other.First) && EqualityComparer<TSecond>.Default.Equals(this.Second, other.Second);
        }

        public override bool Equals(object obj)
        {
            if (ReferenceEquals(null, obj))
            {
                return false;
            }
            if (ReferenceEquals(this, obj))
            {
                return true;
            }
            if (obj.GetType() != this.GetType())
            {
                return false;
            }
            return Equals((Pair<TFirst, TSecond>)obj);
        }

        public override int GetHashCode()
        {
            unchecked
            {
                return (EqualityComparer<TFirst>.Default.GetHashCode(this.First) * 397) ^ EqualityComparer<TSecond>.Default.GetHashCode(this.Second);
            }
        }
    }

    internal class FenwickTreeInt64
    {
        public FenwickTreeInt64(int size)
        {
            this.m_Size = size;
            m_Tree = new long[size];
        }

        public FenwickTreeInt64(int size, IList<long> tree)
            : this(size)
        {
            for (int i = 0; i < size; i++)
            {
                Inc(i, tree[i]);
            }
        }

        public long Sum(int r)
        {
            long res = 0;
            for (; r >= 0; r = (r & (r + 1)) - 1)
            {
                res += m_Tree[r];
            }
            return res;
        }

        public long Sum(int l, int r)
        {
            return Sum(r) - Sum(l - 1);
        }

        public void Inc(int i, long x)
        {
            for (; i < m_Size; i = i | (i + 1))
            {
                m_Tree[i] += x;
            }
        }

        public void Set(int i, long x)
        {
            Inc(i, x - Sum(i, i));
        }

        private readonly int m_Size;

        private readonly long[] m_Tree;
    }

    internal class AccumulativeDictionary<TKey> : Dictionary<TKey, int>
    {
        public new void Add(TKey key, int value = 1)
        {
            if (this.ContainsKey(key))
            {
                base[key] += value;
            }
            else
            {
                base.Add(key, value);
            }
        }

        public new int this[TKey key]
        {
            get
            {
                return this.ContainsKey(key) ? base[key] : 0;
            }
            set
            {
                this.Add(key, value);
            }
        }
    }

    public class PriorityQueue<T>
    {
        public PriorityQueue(Comparison<T> comparison = null)
        {
            if (comparison == null)
            {
                if (typeof(T).GetInterfaces().Any(i => i == typeof(IComparable<T>)))
                {
                    m_Comparison = (a, b) => ((IComparable<T>)a).CompareTo(b);
                }
                else
                {
                    throw new ApplicationException("Add comparer");
                }
            }
            else
            {
                m_Comparison = comparison;
            }
        }

        public int Count { get; private set; }

        public void Enqueue(T item)
        {
            m_List.Add(item);
            m_Indexes.Add(item, this.Count);
            this.Count++;
            Up(this.Count);
        }

        public T Peek()
        {
            return m_List[0];
        }

        public T Dequeue()
        {
            if (this.Count > 0)
            {
                var result = m_List[0];

                Swap(0, this.Count - 1);
                m_Indexes.Remove(m_List[this.Count - 1]);
                m_List.RemoveAt(this.Count - 1);
                this.Count--;
                this.Down(1);

                return result;
            }
            throw new ApplicationException("Couldn't get element from empty queue");
        }

        public void Update(T item)
        {
            int index = m_Indexes[item];
            this.Up(index + 1);
        }

        private readonly List<T> m_List = new List<T>();

        private readonly Dictionary<T, int> m_Indexes = new Dictionary<T, int>();

        private readonly Comparison<T> m_Comparison;

        private void Up(int index)
        {
            while (index > 1 && m_Comparison.Invoke(m_List[index - 1], m_List[index / 2 - 1]) > 0)
            {
                this.Swap(index - 1, index / 2 - 1);

                index = index / 2;
            }
        }

        private void Down(int index)
        {
            while (2 * index <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index - 1]) < 0
                   || 2 * index + 1 <= this.Count && m_Comparison.Invoke(m_List[index - 1], m_List[2 * index]) < 0)
            {
                if (2 * index + 1 > this.Count || m_Comparison.Invoke(m_List[2 * index - 1], m_List[2 * index]) > 0)
                {
                    this.Swap(index - 1, 2 * index - 1);
                    index = 2 * index;
                }
                else
                {
                    this.Swap(index - 1, 2 * index);
                    index = 2 * index + 1;
                }
            }
        }

        private void Swap(int i, int j)
        {
            var tmp = m_List[i];
            m_List[i] = m_List[j];
            m_List[j] = tmp;

            m_Indexes[m_List[i]] = i;
            m_Indexes[m_List[j]] = j;
        }
    }

    public class DisjointSetUnion<T>
    {
        public DisjointSetUnion()
        {
            m_Parent = new Dictionary<T, T>();
            m_Rank = new Dictionary<T, int>();
        }

        public DisjointSetUnion(DisjointSetUnion<T> set)
        {
            m_Parent = new Dictionary<T, T>(set.m_Parent);
            m_Rank = new Dictionary<T, int>(set.m_Rank);
        }

        private readonly Dictionary<T, T> m_Parent;
        private readonly Dictionary<T, int> m_Rank;

        public int GetRank(T x)
        {
            return m_Rank[x];
        }

        public void MakeSet(T x)
        {
            m_Parent[x] = x;
            this.m_Rank[x] = 0;
        }

        public void UnionSets(T x, T y)
        {
            x = this.FindSet(x);
            y = this.FindSet(y);
            if (!x.Equals(y))
            {
                if (m_Rank[x] < m_Rank[y])
                {
                    T t = x;
                    x = y;
                    y = t;
                }
                m_Parent[y] = x;
                if (m_Rank[x] == m_Rank[y])
                {
                    m_Rank[x]++;
                }
            }
        }

        public T FindSet(T x)
        {
            if (x.Equals(m_Parent[x]))
            {
                return x;
            }
            return m_Parent[x] = this.FindSet(m_Parent[x]);
        }
    }

    internal class HamiltonianPathFinder
    {
        public static void Run()
        {
            int n, m;
            Reader.Read(out n, out m);
            List<int>[] a = new List<int>[n];
            for (int i = 0; i < n; i++)
            {
                a[i] = new List<int>();
            }
            for (int i = 0; i < m; i++)
            {
                int x, y;
                Reader.Read(out x, out y);
                a[x].Add(y);
                a[y].Add(x);
            }

            var rnd = new Random();

            bool[] v = new bool[n];
            int[] p = new int[n];
            for (int i = 0; i < n; i++)
            {
                p[i] = -1;
            }
            int first = rnd.Next(n);
            int cur = first;
            v[cur] = true;

            int count = 1;

            while (true)
            {
                var unb = a[cur].Where(u => !v[u]).ToList();
                int d = unb.Count;
                if (d > 0)
                {
                    int next = unb[rnd.Next(d)];
                    v[next] = true;
                    p[cur] = next;
                    cur = next;
                    count++;
                }
                else
                {
                    if (count  == n && a[cur].Contains(first))
                    {
                        p[cur] = first;
                        break;
                    }

                    d = a[cur].Count;
                    int pivot;
                    do
                    {
                        pivot = a[cur][rnd.Next(d)];
                    }
                    while (p[pivot] == cur);

                    int next = p[pivot];

                    int x = next;
                    int y = -1;
                    while (true)
                    {
                        int tmp = p[x];
                        p[x] = y;
                        y = x;
                        x = tmp;
                        if (y == cur)
                        {
                            break;
                        }
                    }
                    p[pivot] = cur;
                    cur = next;
                }
            }

            cur = first;
            do
            {
                Console.Write("{0} ", cur);
                cur = p[cur];
            }
            while (cur != first);
        }

        public static void WriteTest(int n)
        {
            Console.WriteLine("{0} {1}", 2 * n, 2 * (n - 1) + n);
            for (int i = 0; i < n - 1; i++)
            {
                Console.WriteLine("{0} {1}", 2 * i, 2 * i + 2);
                Console.WriteLine("{0} {1}", 2 * i + 1, 2 * i + 3);
                //Console.WriteLine("{0} {1}", 2 * i + 1, 2 * i + 2);
                //Console.WriteLine("{0} {1}", 2 * i, 2 * i + 3);
            }
            for (int i = 0; i < n; i++)
            {
                Console.WriteLine("{0} {1}", 2 * i, 2 * i + 1);
            }
        }
    }

    internal class Backtrack<T> where T : class
    {
        public Backtrack(Func<T, IEnumerable<T>> generator)
        {
            this.m_Generator = generator;
        }

        public Dictionary<T, T> Generate(T startState)
        {
            var result = new Dictionary<T, T>();
            result.Add(startState, null);

            var queue = new Queue<T>();
            queue.Enqueue(startState);

            while (queue.Count > 0)
            {
                var current = queue.Dequeue();
                var next = m_Generator(current);
                foreach (var state in next)
                {
                    if (!result.ContainsKey(state))
                    {
                        result[state] = current;
                        queue.Enqueue(state);
                    }
                }
            }

            return result;
        }

        private Func<T, IEnumerable<T>> m_Generator;
    }

    public static class Utility
    {
        public static readonly int[] sx = new[] { 1, 0, -1, 0 };
        public static readonly int[] sy = new[] { 0, 1, 0, -1 };

        public static PointInt[] GenerateNeighbors(long x, long y)
        {
            var result = new PointInt[4];
            for (int i = 0; i < 4; i++)
            {
                result[i] = new PointInt(x + sx[i], y + sy[i]);
            }
            return result;
        }

        public static PointInt[] GenerateNeighbors(this PointInt p)
        {
            return GenerateNeighbors(p.X, p.Y);
        }

        public static List<PointInt> GenerateNeighborsWithBounds(long x, long y, int n, int m)
        {
            var result = new List<PointInt>(4);
            for (int i = 0; i < 4; i++)
            {
                var nx = x + sx[i];
                var ny = y + sy[i];
                if (0 <= nx && nx < n && 0 <= ny && ny < m)
                {
                    result.Add(new PointInt(nx, ny));
                }
            }
            return result;
        }

        public static List<PointInt> GenerateNeighborsWithBounds(this PointInt p, int n, int m)
        {
            return GenerateNeighborsWithBounds(p.X, p.Y, n, m);
        }
    }

    internal class Program
    {
        private static StreamReader m_InputStream;

        private static StreamWriter m_OutStream;

        private static void OpenFiles()
        {
            m_InputStream = new StreamReader("input.txt"); //File.OpenText("input.txt");
            Console.SetIn(m_InputStream);

            m_OutStream = new StreamWriter("output.txt"); //File.CreateText("output.txt");
            Console.SetOut(m_OutStream);
        }

        private static void CloseFiles()
        {
            m_OutStream.Flush();

            m_InputStream.Dispose();
            m_OutStream.Dispose();
        }

        private static void Main()
        {
            //Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;

          //  OpenFiles();

            var mainThread = new Thread(() => new Solution().Solve(), 50 * 1024 * 1024);
            mainThread.Start();
            mainThread.Join();

           // CloseFiles();
        }
    }

    internal class Solution
    {
        public void Solve()
        {
            long x, y, m;
            Reader.Read(out x, out y, out m);

            if (x >= m || y >= m)
            {
                Console.WriteLine(0);
                return;
            }

            if (x <= 0 && y <= 0)
            {
                Console.WriteLine(-1);
                return;
            }

            var max = Math.Max(x, y);
            y = x + y - max;
            x = max;
            long ans = 0;
            if (x + y <= 0)
            {
                ans = (-y) / x;
                y += ans * x;
            }

            while (x < m)
            {
                var sum = x + y;
                y = x;
                x = sum;
                ans++;
            }

            Console.WriteLine(ans);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
public class Codeforces
{
    protected static TextReader reader;
    protected static TextWriter writer;
    static object Solve()
    {
        var x = ReadLong(); var y = ReadLong(); var m = ReadLong();
        var b = Math.Min(x, y);
        var a = Math.Max(x, y);
        var ctr = 0;
        if (a <= 0) { if (a >= m) writer.WriteLine(0); else writer.WriteLine(-1); return null; }
        while (a < m)
        {
            var d = (a-b)/a+1;
            ctr += (int)d;
            a = d * a + b;
            b = a;
        }
        writer.WriteLine(ctr);
        return null;
    }
    static void Main()
    {
        reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
        try
        {
            object result = Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
            throw;
        }
        reader.Close();
        writer.Close();
    }
    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }
    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }
    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }
    static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c != '-' && (c < '0' || c > '9'));
        int sign = 1;
        if (c == '-')
        {
            sign = -1;
            c = reader.Read();
        }
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res * sign;
            res *= 10;
            res += c - '0';
        }
    }
    #endregion
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Numerics;
public class Codeforces
{
    protected static TextReader reader;
    protected static TextWriter writer;
    static object Solve()
    {
        var x = ReadLong(); var y = ReadLong(); var m = ReadLong();
        x = Math.Min(x, y);
        y = Math.Max(x, y);
        var ctr = 0;
        if (y <= 0) { if (y >= m) writer.WriteLine(0); else writer.WriteLine(-1); return null; }
        while (x < m)
        {
            var tmp = x + y;
            y = x;
            x = tmp;
            ctr++;
        }
        writer.WriteLine(ctr-1);

        return null;
    }
    static void Main()
    {
        reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
        try
        {
            object result = Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
            throw;
        }
        reader.Close();
        writer.Close();
    }
    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }
    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }
    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }
    #endregion
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;
using System.Numerics;
public class Codeforces
{
    protected static TextReader reader;
    protected static TextWriter writer;
    static object Solve()
    {
        var x = ReadLong(); var y = ReadLong(); var m = ReadLong();
        x = Math.Min(x, y);
        y = Math.Max(x, y);
        var ctr = 0;
        if (y <= 0) { if (y >= m) writer.WriteLine(0); else writer.WriteLine(-1); return null; }
        while (x < m)
        {
            var tmp = x + y;
            y = x;
            x = tmp;
            ctr++;
        }
        writer.WriteLine(ctr);

        return null;
    }
    static void Main()
    {
        reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
        try
        {
            object result = Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
            throw;
        }
        reader.Close();
        writer.Close();
    }
    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }
    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }
    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }
    #endregion
}

using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
public class Codeforces
{
    protected static TextReader reader;
    protected static TextWriter writer;
    static object Solve()
    {
        var x = ReadLong(); var y = ReadLong(); var m = ReadLong();
        var ctr = 0L;
        if (Math.Max(x, y) <= 0) { if (Math.Max(x, y) >= m) writer.WriteLine(0); else writer.WriteLine(-1); return null; }
        if (y < x) { var temp = x; x = y; y = temp; }
        if (x < 0)
        {
            ctr += Math.Abs(x) / y;
            ctr++;
            x = y * ctr + x;
        }
        while (y < m & x < m)
        {
            if (x < y) x += y;
            else y += x;
            ctr++;
        }
        writer.WriteLine(ctr);
        return null;
    }
    static void Main()
    {
        reader = new StreamReader(Console.OpenStandardInput(1024 * 10), System.Text.Encoding.ASCII, false, 1024 * 10);
        writer = new StreamWriter(Console.OpenStandardOutput(1024 * 10), System.Text.Encoding.ASCII, 1024 * 10);
        try
        {
            object result = Solve();
            if (result != null)
                writer.WriteLine(result);
        }
        catch (Exception ex)
        {
            Console.WriteLine(ex);
            throw;
        }
        reader.Close();
        writer.Close();
    }
    #region Read / Write

    private static Queue<string> currentLineTokens = new Queue<string>();

    private static string[] ReadAndSplitLine()
    {
        return reader.ReadLine().Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
    }

    public static string ReadToken()
    {
        while (currentLineTokens.Count == 0)
            currentLineTokens = new Queue<string>(ReadAndSplitLine());
        return currentLineTokens.Dequeue();
    }

    public static int ReadInt()
    {
        return int.Parse(ReadToken());
    }

    public static long ReadLong()
    {
        return long.Parse(ReadToken());
    }

    public static double ReadDouble()
    {
        return double.Parse(ReadToken(), CultureInfo.InvariantCulture);
    }

    public static int[] ReadIntArray()
    {
        return ReadAndSplitLine().Select(int.Parse).ToArray();
    }

    public static long[] ReadLongArray()
    {
        return ReadAndSplitLine().Select(long.Parse).ToArray();
    }

    public static double[] ReadDoubleArray()
    {
        return ReadAndSplitLine().Select(s => double.Parse(s, CultureInfo.InvariantCulture)).ToArray();
    }
    public static int[][] ReadIntMatrix(int numberOfRows)
    {
        int[][] matrix = new int[numberOfRows][];
        for (int i = 0; i < numberOfRows; i++)
            matrix[i] = ReadIntArray();
        return matrix;
    }
    public static int[][] ReadAndTransposeIntMatrix(int numberOfRows)
    {
        int[][] matrix = ReadIntMatrix(numberOfRows);
        int[][] ret = new int[matrix[0].Length][];
        for (int i = 0; i < ret.Length; i++)
        {
            ret[i] = new int[numberOfRows];
            for (int j = 0; j < numberOfRows; j++)
                ret[i][j] = matrix[j][i];
        }
        return ret;
    }

    public static string[] ReadLines(int quantity)
    {
        string[] lines = new string[quantity];
        for (int i = 0; i < quantity; i++)
            lines[i] = reader.ReadLine().Trim();
        return lines;
    }
    public static void WriteArray<T>(IEnumerable<T> array)
    {
        writer.WriteLine(string.Join(" ", array));
    }

    public static void Write<T>(params T[] array)
    {
        WriteArray(array);
    }

    public static void WriteLines<T>(IEnumerable<T> array)
    {
        foreach (var a in array)
            writer.WriteLine(a);
    }
    static int Next()
    {
        int c;
        int res = 0;
        do
        {
            c = reader.Read();
            if (c == -1)
                return res;
        } while (c != '-' && (c < '0' || c > '9'));
        int sign = 1;
        if (c == '-')
        {
            sign = -1;
            c = reader.Read();
        }
        res = c - '0';
        while (true)
        {
            c = reader.Read();
            if (c < '0' || c > '9')
                return res * sign;
            res *= 10;
            res += c - '0';
        }
    }
    #endregion
}

using System;
using System.Linq;
class Program
{
    static void Main()
    {
        var _ = Console.ReadLine().Split().Select(long.Parse).ToArray();
        var x = _[0];
        var y = _[1];
        var m = _[2];
        var ctr = 0L;
        x = Math.Max(x, y);
        y = Math.Min(x, y);
        if (x <= 0)
        {
            if (x > m)
            {
                Console.WriteLine(0);
            }
            else
            {
                Console.WriteLine(-1);
            }
            return;
        }
        while (x < m)
        {
            var tmp = (x - y) / x + 1;
            ctr += tmp;
            x = tmp * x + y;
            y = x;
        }
        Console.WriteLine(ctr);
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Threading;
using System.Numerics;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new System.IO.StreamReader(@"..\..\..\in"));
            Console.SetOut(new System.IO.StreamWriter(@"..\..\..\out"));
            for (int testN = 0; testN < 8; testN++)
            {
#endif
                //SetCulture();
                var x1 = NextLong();
                var y1 = NextLong();
                var m1 = NextLong();
                var x = new BigInteger(x1);
                var y = new BigInteger(y1);
                var m = new BigInteger(m1);
                if (x >= m || y >= m)
                {
                    Console.WriteLine("0");
                }
                else
                {
                    if (m <= 0)
                    {
                        Console.WriteLine("-1");
                    }
                    else if ((x == 0 && y <= 0) || (y == 0 && x <= 0) || (x <= 0 && y <= 0))
                    {
                        Console.WriteLine("-1");
                    }
                    else
                    {
                        var c = new BigInteger(0);
                        if (x < 0)
                        {
                            c += (-x) / y;
                            x += (-x) * c;
                        }
                        if (y < 0)
                        {
                            c += (-y) / x;
                            y += (-y) * c;
                        }
                        while (x < m && y < m)
                        {
                            c++;
                            if (x >= y)
                            {
                                y += x;
                            }
                            else
                            {
                                x += y;
                            }
                        }
                        Console.WriteLine(c);
                    }
                }
                //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, "{0:F4}", res));
#if !ONLINE_JUDGE
                Console.ReadLine();
            }
            Console.In.Close();
            Console.Out.Close();
#endif
        }

        private static char[] _defaultSplitter = new char[] { ' ', '\t' };

        private static void SetCulture()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        }

        private static char[] ReadChars(int n)
        {
            char[] buffer = new char[n];
            Console.In.ReadBlock(buffer, 0, n);
            return buffer;
        }

        private static string[] ReadAll()
        {
            return Console.In.ReadToEnd().Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords()
        {
            return ReadWords(_defaultSplitter);
        }

        private static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        private static int[] ReadInts(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        private static int[] ReadInts()
        {
            return ReadInts(_defaultSplitter);
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static double ReadDouble()
        {
            return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);
        }

        private static int _pos = 0;
        private static string[] _inputLine = new string[0];

        private static void CheckInputLine()
        {
            if (_pos >= _inputLine.Length)
            {
                _inputLine = ReadWords();
                _pos = 0;
            }
        }

        private static string NextWord()
        {
            CheckInputLine();
            return _inputLine[_pos++];
        }

        private static int NextInt()
        {
            CheckInputLine();
            return int.Parse(_inputLine[_pos++]);
        }

        private static long NextLong()
        {
            CheckInputLine();
            return long.Parse(_inputLine[_pos++]);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Threading;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new System.IO.StreamReader(@"..\..\..\in"));
            Console.SetOut(new System.IO.StreamWriter(@"..\..\..\out"));
            for (int testN = 0; testN < 5; testN++)
            {
#endif
                //SetCulture();
                var x = NextLong();
                var y = NextLong();
                var m = NextLong();
                if (m <= 0 && (x != 0 || y != 0))
                {
                    Console.WriteLine("0");
                }
                else
                {
                    if (x == -y || x == 0 || y == 0)
                    {
                        if (m <= Math.Abs(x) || m <= Math.Abs(y))
                        {
                            Console.WriteLine("0");
                        }
                        else
                        {
                            Console.WriteLine("-1");
                        }
                    }
                    else
                    {
                        long c = 0;
                        while (Math.Abs(x) < m && Math.Abs(y) < m)
                        {
                            c++;
                            if (Math.Abs(x) >= Math.Abs(y))
                            {
                                y += x;
                            }
                            else
                            {
                                x += y;
                            }
                        }
                        Console.WriteLine(c - 1);
                    }
                }
                //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, "{0:F4}", res));
#if !ONLINE_JUDGE
                Console.ReadLine();
            }
            Console.In.Close();
            Console.Out.Close();
#endif
        }

        private static char[] _defaultSplitter = new char[] { ' ', '\t' };

        private static void SetCulture()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        }

        private static char[] ReadChars(int n)
        {
            char[] buffer = new char[n];
            Console.In.ReadBlock(buffer, 0, n);
            return buffer;
        }

        private static string[] ReadAll()
        {
            return Console.In.ReadToEnd().Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords()
        {
            return ReadWords(_defaultSplitter);
        }

        private static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        private static int[] ReadInts(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        private static int[] ReadInts()
        {
            return ReadInts(_defaultSplitter);
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static double ReadDouble()
        {
            return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);
        }

        private static int _pos = 0;
        private static string[] _inputLine = new string[0];

        private static void CheckInputLine()
        {
            if (_pos >= _inputLine.Length)
            {
                _inputLine = ReadWords();
                _pos = 0;
            }
        }

        private static string NextWord()
        {
            CheckInputLine();
            return _inputLine[_pos++];
        }

        private static int NextInt()
        {
            CheckInputLine();
            return int.Parse(_inputLine[_pos++]);
        }

        private static long NextLong()
        {
            CheckInputLine();
            return long.Parse(_inputLine[_pos++]);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Threading;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new System.IO.StreamReader(@"..\..\..\in"));
            Console.SetOut(new System.IO.StreamWriter(@"..\..\..\out"));
            for (int testN = 0; testN < 5; testN++)
            {
#endif
                //SetCulture();
                var x = NextLong();
                var y = NextLong();
                var m = NextLong();
                m = Math.Abs(m);
                //if (m <= 0 && (x != 0 || y != 0))
                //{
                //    Console.WriteLine("0");
                //}
                //else
                {
                    if (x == -y || x == 0 || y == 0)
                    {
                        if (m <= Math.Abs(x) || m <= Math.Abs(y))
                        {
                            Console.WriteLine("0");
                        }
                        else
                        {
                            Console.WriteLine("-1");
                        }
                    }
                    else
                    {
                        long c = 0;
                        while (Math.Abs(x) < m && Math.Abs(y) < m)
                        {
                            c++;
                            if (Math.Abs(x) >= Math.Abs(y))
                            {
                                y += x;
                            }
                            else
                            {
                                x += y;
                            }
                        }
                        Console.WriteLine(c);
                    }
                }
                //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, "{0:F4}", res));
#if !ONLINE_JUDGE
                Console.ReadLine();
            }
            Console.In.Close();
            Console.Out.Close();
#endif
        }

        private static char[] _defaultSplitter = new char[] { ' ', '\t' };

        private static void SetCulture()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        }

        private static char[] ReadChars(int n)
        {
            char[] buffer = new char[n];
            Console.In.ReadBlock(buffer, 0, n);
            return buffer;
        }

        private static string[] ReadAll()
        {
            return Console.In.ReadToEnd().Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords()
        {
            return ReadWords(_defaultSplitter);
        }

        private static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        private static int[] ReadInts(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        private static int[] ReadInts()
        {
            return ReadInts(_defaultSplitter);
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static double ReadDouble()
        {
            return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);
        }

        private static int _pos = 0;
        private static string[] _inputLine = new string[0];

        private static void CheckInputLine()
        {
            if (_pos >= _inputLine.Length)
            {
                _inputLine = ReadWords();
                _pos = 0;
            }
        }

        private static string NextWord()
        {
            CheckInputLine();
            return _inputLine[_pos++];
        }

        private static int NextInt()
        {
            CheckInputLine();
            return int.Parse(_inputLine[_pos++]);
        }

        private static long NextLong()
        {
            CheckInputLine();
            return long.Parse(_inputLine[_pos++]);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Threading;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new System.IO.StreamReader(@"..\..\..\in"));
            Console.SetOut(new System.IO.StreamWriter(@"..\..\..\out"));
            for (int testN = 0; testN < 5; testN++)
            {
#endif
                //SetCulture();
                var x = NextLong();
                var y = NextLong();
                var m = NextLong();
                if (m <= 0 && (x != 0 || y != 0))
                {
                    Console.WriteLine("0");
                }
                else
                {
                    if (x == -y || x == 0 || y == 0)
                    {
                        if (m <= Math.Abs(x) || m <= Math.Abs(y))
                        {
                            Console.WriteLine("0");
                        }
                        else
                        {
                            Console.WriteLine("-1");
                        }
                    }
                    else
                    {
                        long c = 0;
                        while (Math.Abs(x) < m && Math.Abs(y) < m)
                        {
                            c++;
                            if (Math.Abs(x) >= Math.Abs(y))
                            {
                                y += x;
                            }
                            else
                            {
                                x += y;
                            }
                        }
                        Console.WriteLine(c);
                    }
                }
                //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, "{0:F4}", res));
#if !ONLINE_JUDGE
                Console.ReadLine();
            }
            Console.In.Close();
            Console.Out.Close();
#endif
        }

        private static char[] _defaultSplitter = new char[] { ' ', '\t' };

        private static void SetCulture()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        }

        private static char[] ReadChars(int n)
        {
            char[] buffer = new char[n];
            Console.In.ReadBlock(buffer, 0, n);
            return buffer;
        }

        private static string[] ReadAll()
        {
            return Console.In.ReadToEnd().Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords()
        {
            return ReadWords(_defaultSplitter);
        }

        private static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        private static int[] ReadInts(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        private static int[] ReadInts()
        {
            return ReadInts(_defaultSplitter);
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static double ReadDouble()
        {
            return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);
        }

        private static int _pos = 0;
        private static string[] _inputLine = new string[0];

        private static void CheckInputLine()
        {
            if (_pos >= _inputLine.Length)
            {
                _inputLine = ReadWords();
                _pos = 0;
            }
        }

        private static string NextWord()
        {
            CheckInputLine();
            return _inputLine[_pos++];
        }

        private static int NextInt()
        {
            CheckInputLine();
            return int.Parse(_inputLine[_pos++]);
        }

        private static long NextLong()
        {
            CheckInputLine();
            return long.Parse(_inputLine[_pos++]);
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Globalization;
using System.Threading;

namespace C
{
    class Program
    {
        static void Main(string[] args)
        {
#if !ONLINE_JUDGE
            Console.SetIn(new System.IO.StreamReader(@"..\..\..\in"));
            Console.SetOut(new System.IO.StreamWriter(@"..\..\..\out"));
            for (int testN = 0; testN < 5; testN++)
            {
#endif
                //SetCulture();
                var x = NextLong();
                var y = NextLong();
                var m = NextLong();
                if (m <= 0)
                {
                    Console.WriteLine("0");
                }
                else
                {
                    if (x == -y || x == 0 || y == 0)
                    {
                        if (m <= Math.Abs(x) && m <= Math.Abs(y))
                        {
                            Console.WriteLine("0");
                        }
                        else
                        {
                            Console.WriteLine("-1");
                        }
                    }
                    else
                    {
                        long c = 0;
                        while (Math.Abs(x) < m || Math.Abs(y) < m)
                        {
                            c++;
                            if (Math.Abs(x) >= Math.Abs(y))
                            {
                                y += x;
                            }
                            else
                            {
                                x += y;
                            }
                        }
                        Console.WriteLine(c - 1);
                    }
                }
                //Console.WriteLine(string.Format(NumberFormatInfo.InvariantInfo, "{0:F4}", res));
#if !ONLINE_JUDGE
                Console.ReadLine();
            }
            Console.In.Close();
            Console.Out.Close();
#endif
        }

        private static char[] _defaultSplitter = new char[] { ' ', '\t' };

        private static void SetCulture()
        {
            Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture;
        }

        private static char[] ReadChars(int n)
        {
            char[] buffer = new char[n];
            Console.In.ReadBlock(buffer, 0, n);
            return buffer;
        }

        private static string[] ReadAll()
        {
            return Console.In.ReadToEnd().Split(new char[] { ' ', '\t', '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries);
        }

        private static string[] ReadWords()
        {
            return ReadWords(_defaultSplitter);
        }

        private static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        private static int[] ReadInts(char[] splitter)
        {
            return Console.ReadLine().Split(splitter, StringSplitOptions.RemoveEmptyEntries).Select(x => int.Parse(x)).ToArray();
        }

        private static int[] ReadInts()
        {
            return ReadInts(_defaultSplitter);
        }

        private static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        private static double ReadDouble()
        {
            return double.Parse(Console.ReadLine(), NumberFormatInfo.InvariantInfo);
        }

        private static int _pos = 0;
        private static string[] _inputLine = new string[0];

        private static void CheckInputLine()
        {
            if (_pos >= _inputLine.Length)
            {
                _inputLine = ReadWords();
                _pos = 0;
            }
        }

        private static string NextWord()
        {
            CheckInputLine();
            return _inputLine[_pos++];
        }

        private static int NextInt()
        {
            CheckInputLine();
            return int.Parse(_inputLine[_pos++]);
        }

        private static long NextLong()
        {
            CheckInputLine();
            return long.Parse(_inputLine[_pos++]);
        }
    }
}

using System;

namespace PerfectPair
{
    partial class PerfectPair
    {
        static void Main(string[] args)
        {
            long x, y, m, diff, diffX, diffY, temp, min = 0, max = 0, count = 0;

            x = NextLong();
            y = NextLong();
            m = NextLong();

            diffX = m - x;
            diffY = m - y;

            min = Math.Min(x, y);
            max = Math.Max(x, y);

            if ((min >= 0 && m < 0) || (max <= 0 && m > 0))
                Console.WriteLine(-1);
            else if (max >= m)
                Console.WriteLine(0);
            else
            {
                while (true)
                {
                    diff = m - min;

                    if (m > 0 && max < diff)
                    {
                        count++;
                        temp = max;
                        max += min;
                        min = temp;

                        min = Math.Min(min, max);
                        max = Math.Max(temp, max);
                    }
                    else
                    {
                        Console.WriteLine(count + 1);
                        break;
                    }
                }
            }
        }
    }

    partial class PerfectPair
    {
        static string[] tokens = new string[0];
        static int cur_token = 0;

        static void ReadArray(char sep)
        {
            cur_token = 0;
            tokens = Console.ReadLine().Split(sep);
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int NextInt()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return int.Parse(tokens[cur_token++]);
        }

        static long NextLong()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return long.Parse(tokens[cur_token++]);
        }

        static double NextDouble()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return double.Parse(tokens[cur_token++]);
        }

        static decimal NextDecimal()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return decimal.Parse(tokens[cur_token++]);
        }

        static string NextToken()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return tokens[cur_token++];
        }

        static string ReadLine()
        {
            return Console.ReadLine();
        }
    }
}

using System;

namespace PerfectPair
{
    partial class PerfectPair
    {
        static void Main(string[] args)
        {
            long x, y, m, diff, diffX, diffY, temp, min = 0, max = 0, count = 0, diffVal, increment;

            x = NextLong();
            y = NextLong();
            m = NextLong();

            diffX = m - x;
            diffY = m - y;

            min = Math.Min(x, y);
            max = Math.Max(x, y);

            if ((min >= 0 && m < 0) || (max <= 0 && m > 0) || (max <= 0 && m > max))
                Console.WriteLine(-1);
            else if (max >= m)
                Console.WriteLine(0);
            else
            {
                while (true)
                {
                    diff = m - min;

                    if (max < diff)
                    {
                        diffVal = max - min + 1;

                        increment = (diffVal / max);
                        increment += diffVal % max == 0 ? 0 : 1;

                        count += increment;

                        temp = max;
                        max = min + increment * max;
                        min = temp;

                        min = Math.Min(min, max);
                        max = Math.Max(temp, max);
                    }
                    else
                    {
                        if (m - max > 0)
                            count++;

                        Console.WriteLine(count);
                        break;
                    }
                }
            }
        }
    }

    partial class PerfectPair
    {
        static string[] tokens = new string[0];
        static int cur_token = 0;

        static void ReadArray(char sep)
        {
            cur_token = 0;
            tokens = Console.ReadLine().Split(sep);
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int NextInt()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return int.Parse(tokens[cur_token++]);
        }

        static long NextLong()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return long.Parse(tokens[cur_token++]);
        }

        static double NextDouble()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return double.Parse(tokens[cur_token++]);
        }

        static decimal NextDecimal()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return decimal.Parse(tokens[cur_token++]);
        }

        static string NextToken()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return tokens[cur_token++];
        }

        static string ReadLine()
        {
            return Console.ReadLine();
        }
    }
}

using System;

namespace PerfectPair
{
    partial class PerfectPair
    {
        static void Main(string[] args)
        {
            long x, y, m, diff, diffX, diffY, temp, min, max, count = 0, prevDiff = 0;
            bool noAnswer = false;

            x = NextLong();
            y = NextLong();
            m = NextLong();

            diffX = m - x;
            diffY = m - y;

            min = Math.Min(x, y);
            max = Math.Max(x, y);

            if (max >= m)
                Console.WriteLine(0);
            else
            {
                while (true)
                {
                    diff = m - min;

                    if (count > 0)
                    {
                        if (prevDiff <= diff)
                        {
                            noAnswer = true;
                            break;
                        }
                    }

                    prevDiff = diff;

                    if (max < diff)
                    {
                        count++;
                        temp = max;
                        max += min;
                        min = temp;

                        min = Math.Min(min, max);
                        max = Math.Max(temp, max);
                    }
                    else
                    {
                        Console.WriteLine(count + 1);
                        break;
                    }
                }

            }

            if (noAnswer)
                Console.WriteLine(-1);
        }
    }

    partial class PerfectPair
    {
        static string[] tokens = new string[0];
        static int cur_token = 0;

        static void ReadArray(char sep)
        {
            cur_token = 0;
            tokens = Console.ReadLine().Split(sep);
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static long ReadLong()
        {
            return long.Parse(Console.ReadLine());
        }

        static int NextInt()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return int.Parse(tokens[cur_token++]);
        }

        static long NextLong()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return long.Parse(tokens[cur_token++]);
        }

        static double NextDouble()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return double.Parse(tokens[cur_token++]);
        }

        static decimal NextDecimal()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return decimal.Parse(tokens[cur_token++]);
        }

        static string NextToken()
        {
            if (cur_token == tokens.Length)
                ReadArray(' ');
            return tokens[cur_token++];
        }

        static string ReadLine()
        {
            return Console.ReadLine();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long   x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            int mp=mperfect(x, y, m);

            Console.WriteLine(mp);
            Console.ReadLine();

        }

        protected static int mperfect(long x, long y, long m)
        {
            int i = 0;
            if (x < 0 && y < 0 && ((x < m) || (y < m)))
                return -1;
            else if((x==0 &&  y<0) || ((y == 0) && (x <0)))
               return -1;
            else
            {
                while (x < m && y < m)
                {
                        if (x < y)
                        {
                            x = x + y;
                            i++;
                            if (x >= m || y >= m)
                                return i;
                        }
                        else
                        {
                            y = x + y;
                            i++;
                            if (x >= m || y >= m)
                                return i;
                        }

                }

                return 0;

            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long   x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            int mp=mperfect(x, y, m);

            Console.WriteLine(mp);
            Console.ReadLine();

        }

        protected static int mperfect(long x, long y, long m)
        {
            int i = 0;
            if (x <= 0 && y <= 0 && ((x < m) || (y < m)))
                return -1;
            else if((x==0 &&  y<0) || ((y == 0) && (x <0)))
               return -1;

            else
            {
                while (x < m && y < m)
                {
                        if (x < y)
                        {
                            x = x + y;
                            i++;
                            if (x >= m || y >= m)
                                return i;
                        }
                        else
                        {
                            y = x + y;
                            i++;
                            if (x >= m || y >= m)
                                return i;
                        }

                }

                return 0;

            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long   x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            int mp=mperfect(x, y, m);

            Console.WriteLine(mp);
            Console.ReadLine();

        }

        protected static int mperfect(long x, long y, long m)
        {
            int i = 0;
            if (x < 0 && y < 0 && ((x < m) || (y < m)))
                return -1;
            else if((x==0 || y==0) && ((x < 0) || (y <0)))
               return -1;
            else
            {
                while (x < m && y < m)
                {
                        if (x < y)
                        {
                            x = x + y;
                            i++;
                            if (x >= m || y >= m)
                                return i;
                        }
                        else
                        {
                            y = x + y;
                            i++;
                            if (x >= m || y >= m)
                                return i;
                        }

                }

                return 0;

            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            int mp=mperfect(x, y, m);

            Console.WriteLine(mp);
            Console.ReadLine();

        }

        protected static int mperfect(long x,long y,long m)
        {
            int i = 0;
            if (x < 0 && y < 0 && ((x < m) || (y < m)))
                return -1;
            else if((x==0 || y==0) && ((x < m) && (y < m)))
                return -1;
            else
            {
                while (x < m && y < m)
                {
                        if (x < y)
                        {
                            x = x + y;
                            i++;
                            if (x >= m || y >= m)
                                return i;
                        }
                        else
                        {
                            y = x + y;
                            i++;
                            if (x >= m || y >= m)
                                return i;
                        }

                }
                return 0;

            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            int mp=mperfect(x, y, m);

            Console.WriteLine(mp);
            Console.ReadLine();

        }

        protected static int mperfect(long x,long y,long m)
        {
            int i = 0;
            if (x < 0 && y < 0 && ((x < m) || (y < m)))
                return -1;
            else if(x==0 || y==0 && ((x < m) && (y < m)))
                return -1;
            else
            {
                while (x < m && y < m)
                {
                        if (x < y)
                        {
                            x = x + y;
                            i++;
                            if (x >= m || y >= m)
                                return i;
                        }
                        else
                        {
                            y = x + y;
                            i++;
                            if (x >= m || y >= m)
                                return i;
                        }

                }
                return 0;

            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long   x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            int p=mperfect(x, y, m);

            Console.WriteLine(p);
            Console.ReadLine();

        }

        protected static int mperfect(long x, long y, long m)
        {
            int i = 0;
            if (x < 0 && y < 0 && ((x < m) || (y < m)))
                return -1;
            else if ((x == 0 && y < 0 && (x < m && y < m)) || ((y == 0) && (x < 0) && (x < m && y < m)))
                return -1;
            else if (x == 0 && y == 0 && y < m)
                return -1;
            else
            {
                while (x < m && y < m)
                {
                    if (x < y)
                    {
                        x = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }
                    else
                    {
                        y = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }

                }

                return 0;

            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long   x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            long p=mperfect(x, y, m);

            Console.WriteLine(p);
            Console.ReadLine();

        }

        protected static long mperfect(long x, long y, long m)
        {
            long i = 0;

            if (x >= m || y >= m)
                return 0;
             if (x <= 0 && y <= 0 )
                return -1;

             if (x > y)
             {
                 //x ^= y;
                 //y ^= x;
                 //x ^= y;

                 x ^= y ^= x ^= y;
             }

                if (x < 0 && y > 0)
                {
                    i = -x / y;
                    x = x + y * i;
                }
                else if (y < 0 && x > 0)
                {
                    i = -y / x;
                    y = y + x * i;
                }

                while (x < m && y < m)
                {
                    if (x < y)
                    {
                        x = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }
                    else
                    {
                        y = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }

                }

                return i;

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long   x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            long p=mperfect(x, y, m);

            Console.WriteLine(p);
            Console.ReadLine();

        }

        protected static long mperfect(long x, long y, long m)
        {
            long i = 0;
            if (x < 0 && y < 0 && ((x < m) && (y < m)))
                return -1;
            else if ((x == 0 && y < 0 && (x < m && y < m)) || ((y == 0) && (x < 0) && (x < m && y < m)))
                return -1;
            else if (x == 0 && y == 0 && y < m)
                return -1;

            else
            {
                  if (x < 0 && y > 0)
                   {
                      i = -x / y;
                      x =x+ y*i;
                   }
                  else if (y < 0 && x > 0)
                  {
                      i = -y / x;
                      y =y+ x*i;
                  }
                while (x < m && y < m)
                {

                    if (x < y)
                    {
                        x = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }
                    else
                    {
                        y = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }

                }

                return i;

            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            long   x=0, y=0, m = 0;
            x =long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);

            int mp=mperfect(x, y, m);

            Console.WriteLine(mp);
            Console.ReadLine();

        }

        protected static int mperfect(long x, long y, long m)
        {
            int i = 0;
            if (x < 0 && y < 0 && ((x < m) || (y < m)))
                return -1;
            else if ((x == 0 && y < 0 && (x < m && y < m)) || ((y == 0) && (x < 0) && (x < m && y < m)))
                return -1;
            else if (x == 0 && y == 0 && y < m)
                return -1;
            else
            {
                while (x < m && y < m)
                {
                    if (x < y)
                    {
                        x = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }
                    else
                    {
                        y = x + y;
                        i++;
                        if (x >= m || y >= m)
                            return i;
                    }

                }

                return 0;

            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace m_perfect
{
    class Program
    {
        static void Main(string[] args)
        {

            string[] tokens = Console.ReadLine().Split(' ');

            double   x=0, y=0, m = 0;
            x =double.Parse(tokens[0]);
            y = double.Parse(tokens[1]);
            m = double.Parse(tokens[2]);

            int mp=mperfect(x, y, m);

            Console.WriteLine(mp);
            Console.ReadLine();

        }

        protected static int mperfect(double x, double y, double m)
        {
            int i = 0;
            if (x < 0 && y < 0 && ((x < m) || (y < m)))
                return -1;
            else if((x==0 || y==0) && ((x < m) && (y < m)))
                return -1;
            else
            {
                while (x < m && y < m)
                {
                        if (x < y)
                        {
                            x = x + y;
                            i++;
                            if (x >= m || y >= m)
                                return i;
                        }
                        else
                        {
                            y = x + y;
                            i++;
                            if (x >= m || y >= m)
                                return i;
                        }

                }

                return 0;

            }

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {

      public static Int64  caculate(Int64 big , Int64 small, Int64 target)
        {
            Int64 step1 = small / (big * -1);
            if (big * step1 + small < 0)
            {
                step1++;
            }
            Int64 start = small + big * step1;

            Int64 next = start + big;
            while (start < target)
            {
                step1++;
                Int64 tmp = start;
                start = next;
                next = start + next;
            }

            return step1;
        }
        static void Main(string[] args)
        {
                string input = Console.ReadLine();

                string[] array = input.Split(' ');
                Int64 x = Int64.Parse(array[0]);
                Int64 y = Int64.Parse(array[1]);
                Int64 m = Int64.Parse(array[2]);

                if (x >= m || y >= m)
                {
                    Console.WriteLine("0");
                }
                else
                {
                    Int64 bigger = x > y ? x : y;
                    Int64 smaller = x > y ? y : x;
                    Int64 sub = bigger - smaller;

                    if (bigger <= 0)
                    {
                        Console.WriteLine("-1");
                    }
                    else
                    {
                        Console.WriteLine(caculate(bigger, smaller, m));
                    }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {
        static void Main(string[] args)
        {
                string input = Console.ReadLine();

                string[] array = input.Split(' ');
                Int64 x = Int64.Parse(array[0]);
                Int64 y = Int64.Parse(array[1]);
                Int64 m = Int64.Parse(array[2]);

                if (x >= m || y >= m)
                {
                    Console.WriteLine("0");
                }
                else
                {
                    Int64 bigger = x > y ? x : y;
                    Int64 smaller = x > y ? y : x;
                    Int64 sub = bigger - smaller;

                    if (bigger <= 0)
                    {
                        Console.WriteLine("-1");
                    }
                    else
                    {
                       Int64 step = (m - smaller) / bigger;
                       if (step * bigger + smaller >= m)
                       {
                           Console.WriteLine(step);
                       }
                       else
                       {
                           Console.WriteLine(step + 1);
                       }
                    }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {

      public static Int64  caculate(Int64 big , Int64 small, Int64 target)
        {
            Int64 step = -1;
          Int64 last = small;
          Int64 next = big;
          while (last < target)
          {
              step++;
              Int64 tmp = last + next;
              last = next;
              next = tmp;
          }
          return step;
        }
        static void Main(string[] args)
        {
                string input = Console.ReadLine();

                string[] array = input.Split(' ');
                Int64 x = Int64.Parse(array[0]);
                Int64 y = Int64.Parse(array[1]);
                Int64 m = Int64.Parse(array[2]);

                if (x >= m || y >= m)
                {
                    Console.WriteLine("0");
                }
                else
                {
                    Int64 bigger = x > y ? x : y;
                    Int64 smaller = x > y ? y : x;
                    Int64 sub = bigger - smaller;

                    if (bigger <= 0)
                    {
                        Console.WriteLine("-1");
                    }
                    else
                    {
                        Console.WriteLine(caculate(bigger, smaller, m));
                    }
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace ConsoleApplication1
{
    class Program
    {

      public static Int64  caculate(Int64 big , Int64 small, Int64 target)
        {
            Int64 start=0, step1=0, next=0;
            if (small < 0)
            {
                 step1 = small / (big * -1);
                if (big * step1 + small < 0)
                {
                    step1++;
                }

                start = small + big * step1 > big ? small + big*step1 : big;
                next = small + big * step1 + big;
            }
            else
            {
                start = big;
                next = small + big;
            }
            while (start < target)
            {
                step1++;
                Int64 tmp = start;
                start = next;
                next = start + next;
            }

            return step1;
        }
        static void Main(string[] args)
        {
                string input = Console.ReadLine();

                string[] array = input.Split(' ');
                Int64 x = Int64.Parse(array[0]);
                Int64 y = Int64.Parse(array[1]);
                Int64 m = Int64.Parse(array[2]);

                if (x >= m || y >= m)
                {
                    Console.WriteLine("0");
                }
                else
                {
                    Int64 bigger = x > y ? x : y;
                    Int64 smaller = x > y ? y : x;
                    Int64 sub = bigger - smaller;

                    if (bigger <= 0)
                    {
                        Console.WriteLine("-1");
                    }
                    else
                    {
                        Console.WriteLine(caculate(bigger, smaller, m));
                    }
            }
        }
    }
}

#define Online

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;

namespace CF
{
    delegate double F(double x);
    delegate decimal Fdec(decimal x);

    class Program
    {

        static void Main(string[] args)
        {

#if FileIO
            StreamReader sr = new StreamReader("input.txt");
            StreamWriter sw = new StreamWriter("output.txt");
            Console.SetIn(sr);
            Console.SetOut(sw);
#endif

            C();

#if Online
            Console.ReadLine();
#endif

#if FileIO
            sr.Close();
            sw.Close();
#endif
        }

        static void A()
        {
            long n, k;
            string[] tokens = ReadArray(' ');
            n = long.Parse(tokens[0]);
            k = long.Parse(tokens[1]);
            long even = n / 2L;
            long odd = n % 2L == 0L ? n / 2L : n / 2L + 1L;
            if (k <= odd)
            {
                Console.WriteLine(1L + (k - 1L) * 2L);
            }
            else
            {
                Console.WriteLine((k - odd) * 2L);
            }
        }

        static void B()
        {
            string row = ReadLine();
            long ans = 0;
            long[] heavy = new long[row.Length];
            long[] metal = new long[row.Length];
            string h = "heavy";
            string m = "metal";
            for (int i = 0; i < row.Length - 4; i++)
            {
                heavy[i + 4] = heavy[i + 3];
                bool isHeavy = true;
                for (int j = i, z = 0; z < 5; j++, z++)
                {
                    if (row[j] != h[z])
                    {
                        isHeavy = false;
                        break;
                    }
                }
                if (isHeavy)
                    heavy[i + 4]++;
            }
            for (int i = row.Length - 1; i >= 4; i--)
            {
                metal[i - 4] = metal[i - 3];
                bool isMetal = true;
                for (int j = i - 4, z = 0; z < 5; j++, z++)
                {
                    if (row[j] != m[z])
                    {
                        isMetal = false;
                        break;
                    }
                }
                if (isMetal)
                    metal[i - 4]++;
            }
            for (int i = 4; i < row.Length - 4; i++)
            {
                ans += (heavy[i] - heavy[i - 1]) * metal[i + 1];
            }
            Console.WriteLine(ans);
        }

        static void C()
        {
            long x, y, m;
            string[] tokens = ReadArray(' ');
            x = long.Parse(tokens[0]);
            y = long.Parse(tokens[1]);
            m = long.Parse(tokens[2]);
            long ans = 0;
            if (x <= 0 && y <= 0)
            {
                if (Math.Max(x, y) >= m)
                {
                    Console.WriteLine(0);
                }
                else
                {
                    Console.WriteLine(-1);
                }
                return;
            }
            if (x < 0 || y < 0)
            {
                if (x < y)
                {
                    ans += -x / y;
                    x += (-x / y) * y;
                }
                else
                {
                    ans += -y / x;
                    y += (-y / x) * x;
                }
            }
            while (Math.Max(x, y) < m)
            {
                if (x <= y)
                {
                    x += y;
                }
                else
                {
                    y += x;
                }
                ans++;
            }
            Console.WriteLine(ans);
        }

        static void D()
        {

        }

        static void E()
        {

        }

        static void TestGen()
        {

        }

        static string[] ReadArray(char sep)
        {
            return Console.ReadLine().Split(sep);
        }

        static int ReadInt()
        {
            return int.Parse(Console.ReadLine());
        }

        static string ReadLine()
        {
            return Console.ReadLine();
        }
    }

    public static class MyMath
    {
        public static long BinPow(long a, long n, long mod)
        {
            long res = 1;
            while (n > 0)
            {
                if ((n & 1) == 1)
                {
                    res = (res * a) % mod;
                }
                a = (a * a) % mod;
                n >>= 1;
            }
            return res;
        }

        public static long GCD(long a, long b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static int GCD(int a, int b)
        {
            while (b != 0) b = a % (a = b);
            return a;
        }

        public static long LCM(long a, long b)
        {
            return (a * b) / GCD(a, b);
        }

        public static int LCM(int a, int b)
        {
            return (a * b) / GCD(a, b);
        }
    }

    class Edge
    {
        public int a;
        public int b;
        public int w;

        public Edge(int a, int b, int w)
        {
            this.a = a;
            this.b = b;
            this.w = w;
        }
    }

    class Graph
    {
        public List<int>[] g;
        public int[] color; //0-white, 1-gray, 2-black
        public int[] o; //open
        public int[] c; //close
        public int[] p;
        public int[] d;
        public List<Edge> e;
        public Stack<int> ans = new Stack<int>();
        public Graph(int n)
        {
            g = new List<int>[n + 1];
            for (int i = 0; i <= n; i++)
                g[i] = new List<int>();
            color = new int[n + 1];
            o = new int[n + 1];
            c = new int[n + 1];
            p = new int[n + 1];
            d = new int[n + 1];
        }

        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public bool DFS(int u, ref int time)
        {
            color[u] = gray;
            time++;
            o[u] = time;
            for (int i = 0; i < g[u].Count; i++)
            {
                int v = g[u][i];
                if (color[v] == gray)
                {
                    return true;
                }
                if (color[v] == white)
                {
                    p[v] = u;
                    if (DFS(v, ref time)) return true;
                }
            }
            color[u] = black;
            ans.Push(u);
            c[u] = time;
            time++;
            return false;
        }
    }

    static class GraphUtils
    {
        const int white = 0;
        const int gray = 1;
        const int black = 2;

        public static void BFS(int s, Graph g)
        {
            Queue<int> q = new Queue<int>();
            q.Enqueue(s);
            while (q.Count != 0)
            {
                int u = q.Dequeue();
                for (int i = 0; i < g.g[u].Count; i++)
                {
                    int v = g.g[u][i];
                    if (g.color[v] == white)
                    {
                        g.color[v] = gray;
                        g.d[v] = g.d[u] + 1;
                        g.p[v] = u;
                        q.Enqueue(v);
                    }
                }
                g.color[u] = black;
            }
        }

        public static bool DFS(int u, ref int time, Graph g, Stack<int> st)
        {
            g.color[u] = gray;
            time++;
            g.o[u] = time;
            for (int i = 0; i < g.g[u].Count; i++)
            {
                int v = g.g[u][i];
                if (g.color[v] == gray)
                {
                    return true;
                }
                if (g.color[v] == white)
                {
                    g.p[v] = u;
                    if (DFS(v, ref time, g, st)) return true;
                }
            }
            g.color[u] = black;
            st.Push(u);
            g.c[u] = time;
            time++;
            return false;
        }

        public static void FordBellman(int u, Graph g)
        {
            int n = g.g.Length;
            for (int i = 0; i <= n; i++)
            {
                g.d[i] = int.MaxValue;
                g.p[i] = 0;
            }

            g.d[u] = 0;

            for (int i = 0; i < n - 1; i++)
            {
                for (int j = 0; j < g.e.Count; j++)
                {
                    if (g.d[g.e[j].a] != int.MaxValue)
                    {
                        if (g.d[g.e[j].a] + g.e[j].w < g.d[g.e[j].b])
                        {
                            g.d[g.e[j].b] = g.d[g.e[j].a] + g.e[j].w;
                            g.p[g.e[j].b] = g.e[j].a;
                        }
                    }
                }
            }
        }
    }

    static class ArrayUtils
    {
        public static int BinarySearch(int[] a, int val)
        {
            int left = 0;
            int right = a.Length - 1;
            int mid;

            while (left < right)
            {
                mid = left + ((right - left) >> 1);
                if (val <= a[mid])
                {
                    right = mid;
                }
                else
                {
                    left = mid + 1;
                }
            }

            if (a[left] == val)
                return left;
            else
                return -1;
        }

        public static double Bisection(F f, double left, double right, double eps)
        {
            double mid;
            while (right - left > eps)
            {
                mid = left + ((right - left) / 2d);
                if (Math.Sign(f(mid)) != Math.Sign(f(left)))
                    right = mid;
                else
                    left = mid;
            }
            return (left + right) / 2d;
        }

        public static decimal TernarySearchDec(Fdec f, decimal eps, decimal l, decimal r, bool isMax)
        {
            decimal m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3m;
                m2 = r - (r - l) / 3m;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static double TernarySearch(F f, double eps, double l, double r, bool isMax)
        {
            double m1, m2;
            while (r - l > eps)
            {
                m1 = l + (r - l) / 3d;
                m2 = r - (r - l) / 3d;
                if (f(m1) < f(m2))
                    if (isMax)
                        l = m1;
                    else
                        r = m2;
                else
                    if (isMax)
                        r = m2;
                    else
                        l = m1;
            }
            return r;
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R, Comparison<T> comp)
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (comp(L[i], R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R, Comparison<T> comp)
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R, comp);
            Merge_Sort(A, q + 1, r, L, R, comp);
            Merge(A, p, q, r, L, R, comp);
        }

        public static void Merge<T>(T[] A, int p, int q, int r, T[] L, T[] R) where T : IComparable<T>
        {
            for (int i = p; i <= q; i++)
                L[i] = A[i];
            for (int i = q + 1; i <= r; i++)
                R[i] = A[i];

            for (int k = p, i = p, j = q + 1; k <= r; k++)
            {
                if (i > q)
                {
                    for (; k <= r; k++, j++)
                        A[k] = R[j];
                    return;
                }
                if (j > r)
                {
                    for (; k <= r; k++, i++)
                        A[k] = L[i];
                    return;
                }
                if (L[i].CompareTo(R[j]) <= 0)
                {
                    A[k] = L[i];
                    i++;
                }
                else
                {
                    A[k] = R[j];
                    j++;
                }
            }
        }

        public static void Merge_Sort<T>(T[] A, int p, int r, T[] L, T[] R) where T : IComparable<T>
        {
            if (p >= r) return;
            int q = p + ((r - p) >> 1);
            Merge_Sort(A, p, q, L, R);
            Merge_Sort(A, q + 1, r, L, R);
            Merge(A, p, q, r, L, R);
        }

        static void Shake<T>(T[] a)
        {
            Random rnd = new Random(Environment.TickCount);
            T temp;
            int b, c;
            for (int i = 0; i < a.Length; i++)
            {
                b = rnd.Next(0, a.Length);
                c = rnd.Next(0, a.Length);
                temp = a[b];
                a[b] = a[c];
                a[c] = temp;
            }
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Codeforces
{
    class Program
    {

        static void Main(string[] args)
        {

            String s = Console.ReadLine();

            char[] c = {' '};

            String[] a = s.Split(c, 3, StringSplitOptions.RemoveEmptyEntries);

            long x = long.Parse(a[0]), tx = x;
            long y = long.Parse(a[1]), ty = y;
            long m = long.Parse(a[2]);

            long ans = 0;

            while (tx < m && ty < m){

                long tempX = tx, tempY = ty;

                if (tx < ty){

                    if (ty != 0){

                        ans += ((ty - tx) / ty + 1);

                        tx = tx + ty * ((ty - tx) / ty + 1);

                    }
                    else {

                        ans = -1;

                        break;

                    }

                }
                else {

                    if (tx != 0){

                        ans += ((tx - ty) / tx + 1);

                        ty = ty + tx * ((tx - ty) / tx + 1);

                    }
                    else {

                        ans = -1;

                        break;

                    }

                }

                if (Math.Abs(tx - m) >= Math.Abs(tempX - m)
                    && Math.Abs(ty - m) >= Math.Abs(tempY - m)){

                    ans = -1;

                    break;

                }

            }

            Console.WriteLine(ans);

        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace codegh
{
    class Program
    {
        static void Main(string[] args)
        {
            List<long> mas = Console.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(n => Convert.ToInt64(n)).ToList();
            long k = 0;
            if (Math.Max(mas[0], mas[1]) < mas[2] && mas[0]<=0&&mas[1]<=0)
            {
                Console.WriteLine(-1);
                return;
            }
            if (mas[0] > mas[1])
            {
                long c = mas[0];
                mas[0] = mas[1];
                mas[1] = c;
            }
            if (mas[1] == mas[2])
            {
                Console.WriteLine(0);
                return;
            }
            if (mas[0]<0)
            {

                if (mas[0] % mas[1] == 0)
                {
                    k += Math.Abs((mas[0] / mas[1]));
                }else
                {
                    k +=Math.Abs( (mas[0] / mas[1]))+1;
                }
                mas[0] += mas[1] * k;
            }
            if (mas[0] + mas[1] > mas[2])
            {
                k -= (Math.Abs(mas[2] - mas[1] - mas[0]) / mas[1]);
            }
            while(Math.Max(mas[0], mas[1]) < mas[2])
            {

                long s = mas[0] + mas[1];
                mas[0] = mas[1];
                mas[1] = s;
                k++;
            }
            Console.WriteLine(k);
           // Console.ReadKey();
        }
    }
}

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace codegh
{
    class Program
    {
        static void Main(string[] args)
        {
            List<long> mas = Console.ReadLine().Split(new string[] { " " }, StringSplitOptions.RemoveEmptyEntries).Select(n => Convert.ToInt64(n)).ToList();
            long k = 0;
            if (Math.Max(mas[0], mas[1]) < mas[2] && mas[0] + mas[1] <= 0)
            {
                Console.WriteLine(-1);
                return;
            }
            if (mas[0] > mas[1])
            {
                long c = mas[0];
                mas[0] = mas[1];
                mas[1] = c;
            }
            while(Math.Max(mas[0], mas[1]) < mas[2])
            {
                long s = mas[0] + mas[1];
                mas[0] = mas[1];
                mas[1] = s;
                k++;
            }
            Console.WriteLine(k);
          //  Console.ReadKey();
        }
    }
}