#include <iostream>

using namespace std;

int main()
{
    int n,m,k;
    cin >> n >> m >> k;
    if (k <= m && k <= n){
        int a = n/k + n%k;
        int b = m/k + m%k;
        cout << a*b << endl;
    }
    else {
        if(k > n && k > m){
        cout << 1 << endl;
        }
        else if((k>n && k<m)){
            cout << m/k + m%k;
        }
        else if((k<n && k>m)){
            cout << n/k + n%k;
        }
    }
    return 0;
}
