/*
TASK: minjumps
LANG: C++
*/
#include<iostream.h>
#include<math.h>
long a,b,n,min,max,sum,br;
int c[2002];
int jumps(long x)
{ c[x]=1;
 if(abs(x)>10000) return 0;
   else if(x==n)  return br;
  else
    { br++;
      if(c[x+a]==0) jumps(x+a);
      if(c[x-a]==0) jumps(x-a);
      if(c[x+b]==0) jumps(x+b);
      if(c[x-b]==0) jumps(x-b);
    }
}
int main()
{  cin>>a>>b>>n;
  if(a>b) { max=a; min=b; }
  else { max=b; min=a; }
  if(a%2==0 && b%2==0 && n%2==1) sum=-1;
  else if(n%max==0) sum=n/max;
  else if(n%min==0) sum=n/min;
   else sum=jumps(0);
  cout<<sum<<endl;
  system("pause");
 return 0;
}
