/*
DP
*/
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
const int MAXN = 10005;
int m, n, t;
int d[MAXN];
void dp() {
memset(d, 0x81, sizeof(d));
d[0] = 0;
for(int i=1; i<=t; i++) {
int &cur = d[i];
if(i>=m && cur<d[i-m]+1) cur = d[i-m]+1;
if(i>=n && cur<d[i-n]+1) cur = d[i-n]+1;
}
if(d[t] > 0) {
printf("%d\n", d[t]);
} else {
int i = 1;
while(d[t-i] < 0) i++;
printf("%d %d\n", d[t-i], i);
}
}
int main(){
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
while(scanf("%d%d%d", &m, &n, &t) == 3) {
dp();
}
return 0;
}
/*
贪心:
1)优先吃耗时少的
2)时间没法整除时,考虑吃耗时多的
*/
#include <cstring>
#include <cstdio>
#include <algorithm>
#include <cmath>
using namespace std;
int m, n, t;
void greedy()
{
if(n < m) swap(n, m);
if(t%m == 0) {
printf("%d\n", t/m);
return;
}
//t%m > 0
int cnt = t/m;
int left = t%m;
if(n == m) {
printf("%d %d\n", cnt, left);
return;
}
// n > m
int ri = 0;
int min_beer = left;
for(int i=1; i<=cnt; i++) {
int beer = (i*m + left)%n;
if(beer == 0) {
printf("%d\n", cnt-i + (i*m + left)/n);
return;
} else if(beer < min_beer) {
min_beer = beer;
ri = i;
}
}
printf("%d %d\n", cnt-ri+(ri*m + left)/n, min_beer);
}
int main(){
#ifndef ONLINE_JUDGE
freopen("in.txt", "r", stdin);
#endif
while(scanf("%d%d%d", &m, &n, &t) == 3) {
greedy();
}
return 0;
}