#include <bits/stdc++.h>
#define ll long long
#define pb push_back
#define ent '\n'
#define $ ' '
#define F first
#define S second
using namespace std;

ll n,m,k;

void solve(){
    cin>>n>>m>>k;
    ll a=n/k+n%k;
    ll b=m/k+m%k;
    cout<<a*b;
}

int main()
{
    ios_base::sync_with_stdio(0),cin.tie(0),cout.tie(0);
    ll test=1;
    //cin>>test;
    for(ll i=1;i<=test;i++){
        solve();
        cout<<ent;
    }
}
