/*
TASK:minjumps
LANG:C++
*/
#include <iostream>
using namespace std;
int a,b,n;
int main()
{
    cin >> a >> b >> n;
    if (n<0) n=-n;
    int x,y,cnt=32767;
    for (x=0;x<=5000;x++)
         for (y=0;y<=5000;y++)
              if (n == (x*a-y*b)) if (cnt> x+y) cnt=x+y;
    for (x=0;x<=5000;x++)
         for(y=0;y<=5000;y++)
             if (n == (x*b-y*a)) if (cnt > x+y) cnt=x+y;
    if (cnt==32767) cout <<"-1\n";
    else cout << cnt;
    return 0;
}          
