#include <iostream>
using namespace std;
#define ll long long

ll a, b, l, r, k, n, m;

int main(){
    cin >> n >> m >> k;
    cout << (n / k) * (m / k) + (m % k) * (n / k) + (n % k) * (m / k) + (n % k) * (m % k); 
}
