//p2.cpp
#include<bits/stdc++.h>
using namespace std;
signed main()
{
	ios::sync_with_stdio(false);cin.tie(0);
	int n,m,x;
	cin >> n >> m >> x;
	if(n>m) cout << x/n+x%n+(x%n==0)*n-(x%n==0) << max(x/m+1,x%m) << "\n";
	else cout << x/m+x%m+(x%m==0)*m-(x%m==0) << max(x/m+1,x%m) << "\n";
	return 0;
}