#include <iostream>

using namespace std;

int main()
{
    long long  n, m, k, l;
    cin >> n >> m >> k;
    if (n <= k and m <= k){
        l = 1;
    }
    else if (n <= k){
        l = long(m/k)+(m%k);
    }
    else if(m <= k){
        l = long(n/k)+(n%k);
    }
    else{
        l = (long(n/k)+(n%k))*(long(m/k)+(m%k));
    }
    cout << abs(l);
    
    

    return 0;
}
