
/*
ID: C055
TASK: minjumps
LANG: C++
*/

#include <iostream>
#include <queue>
using namespace std;

int need, n, arr[8];
int was[32768];

inline int index( int c ) { return c + 16000; }
inline int abs( int a ) { return ( a > 0 ) ? a : -a; }

inline bool validCell( int c )
{
    return ( abs( c ) < n && ! was[ index(c) ] );
}


void input()
{
    scanf( "%d %d %d", &arr[0], &arr[1], &need );
    
    arr[2] = -arr[0];
    arr[3] = -arr[1];
    
    n = 100000;
}

void output()
{
    if( was[ index(need) ] )
    {
        printf( "%d", was[ index(need) ]-1 );
    }
    else
    {
        printf( "-1" );
    }
}

void solve()
{
    int level = 1;
    queue<int> Q, nextQ;
    
    Q.push( 0 );
    was[ index(0) ] = level++;
    
    while( ! Q.empty() )
    {
        int top = Q.front();
        Q.pop();
        
        for( int i = 0; i < 4; ++i )
        {
            if( validCell( top + arr[i] ) )
            {
                was[ index( top + arr[i] ) ] = level;
                nextQ.push( top + arr[i] );
            }
        }
        
        if( was[index(need)] ) break;
                
        if( Q.empty() )
        {
            level++;
            
            while( ! nextQ.empty() ) 
            {
               Q.push( nextQ.front() );
               nextQ.pop();
            }
        } 
    }
}

int main()
{
    input();
    solve();
    output();
        
    return 0;
}
