#include <bits/stdc++.h>
using namespace std;
int main() {
    //freopen("input.txt", "r", stdin);
    //freopen("output.txt", "w", stdout);
    ios_base::sync_with_stdio(0); cin.tie(0); cout.tie(0);
    long long m, n, k, x, a = 0, b = 0, ans = 0;
    cin >> n >> m >> k;
    if(n % k > 0){
        a = n % k;
        ans += n % k * k;
    }
    if(m % k > 0){
        b = m % k;
        ans += m % k * k;
    }
    n = n - a;
    m = m - b;
    x = n * m;
    cout << x / (k * k) + ans;
}
