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

#include<cstdio>
#include<queue>
#include<utility>
using std::queue;
using std::pair;

#define MAX_OPT 65536
#define MID 10001

int opt[MAX_OPT], a, b, n;
queue<pair<int, int> > q;
int bfs() {
	q.push(pair<int, int>(0, 0));
	opt[MID+0] = 0;
	pair<int, int> c;
	int n1, n2, n3, n4;
	while(!q.empty()) {
		c = q.front(); q.pop();
		if(opt[MID+c.first] < c.second) continue;
		n1 = c.first+a;
		n2 = c.first+b;
		n3 = c.first-a;
		n4 = c.first-b;
		if(n1 == n || n2 == n || n3 == n || n4 == n) {
			printf("%d\n", c.second+1);
			return 1;
		}
		if(n1 > -MID && n1 < MID) {
			if(opt[MID+n1] == -1 || opt[MID+n1] > c.second+1) {
				opt[MID+n1] = c.second+1;
				q.push(pair<int, int>(n1, c.second+1));
			}
		}
		if(n2 > -MID && n2 < MID) {
			if(opt[MID+n2] == -1 || opt[MID+n2] > c.second+1) {
				opt[MID+n2] = c.second+1;
				q.push(pair<int, int>(n2, c.second+1));
			}
		}
		if(n3 > -MID && n3 < MID) {
			if(opt[MID+n3] == -1 || opt[MID+n3] > c.second+1) {
				opt[MID+n3] = c.second+1;
				q.push(pair<int, int>(n3, c.second+1));
			}
		}
		if(n4 > -MID && n4 < MID) {
			if(opt[MID+n4] == -1 || opt[MID+n4] > c.second+1) {
				opt[MID+n4] = c.second+1;
				q.push(pair<int, int>(n4, c.second+1));
			}
		}
	}
	return 0;
}

void input() {
	scanf("%d%d%d", &a, &b, &n);
}

int main() {
	for(int i = 0; i < MAX_OPT; ++i) opt[i] = -1;
	input();
	if(!bfs()) {
		printf("-1\n");
	}
	return 0;
}
