#include <bits/stdc++.h>
using namespace std;
void soe(vector<long long> &p, long long n) {
  vector<bool> isit(n + 1, 1);
  for (long long i = 2; i * i <= n; i++) {
    long long mult = 2;
    if (isit[i] == 0) {
      continue;
    }
    while (mult * i <= n) {
      isit[mult * i] = 0;
      mult++;
    }
  }
  for (long long i = 2; i <= n; i++) {
    if (isit[i]) {
      p.push_back(i);
    }
  }
}
int32_t main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  cout.tie(NULL);
  long long n;
  long long m;
  cin >> n >> m;
  long long k;
  cin >> k;
  n--;
  m--;
  long long t = n % k + 1;
  long long a = n / k;
  long long b = m / k;
  a++;
  b++;
  long long t1 = m % k + 1;
  cout << t * t1 * a * b;
}
