#include <bits/stdc++.h>
 
#define ll long long 
 
using namespace std;
 
int main()
{
     
    ll n, m, k,sum=0,t,p;
    cin >> t >> p >> k; 
    n = min(t,p);
    m= max(t,p);
    ll y=0, x=0;
    while(y<=m){
        y+=k;
    }
    y-=k;
    while(x<=n){
        x+=k;
    }
    x-=k;
    if(n%k==0){
        t=0;
    }
    else{
        t=1;
    }
    if(k >= 4){
        sum+=x*y/(k*k)+t*y/(k * k)+n*(m-y)/(k * k)+t*(m-y);
    } else {
        sum+=x*y/(k*k)+t*y/k+n*(m-y)/k+t*(m-y);
    }
    cout<<sum;
 
}
