#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;
	sum+=x*y/(k*k)+(n-x)*y/k+n*(m-y)/k;
	cout<<sum;

		
}
