#include <bits/stdc++.h>
#define ll long long
#define pb push_back
using namespace std;
  
const ll N = 1e6 + 5;
const ll mod = 1e9 + 7;
const ll inf = 1e18;
ll n, m, k;
ll f(ll k) {
    ll t = (n + k - 1) / k;
    ll s = (m + k - 1) / k;
    return t * s;
}
bool check(ll mid) {
    if (f(k) <= mid) {
        return true;
    } else {
        return false;
    }
}
int main() {
    cin >> m >> n >> k;
 
    ll l = 0, r = 1e18, ans = 1e18;
    while (l <= r) {
        ll mid = (l + r) / 2;
        if (check(mid)) {
            r = mid - 1;
            ans = mid;
        } else {
            l = mid + 1;
        }
    }
    cout << ans;
}
