#include <bits/stdc++.h>
int sm(int a, int b) {
  if (a % b == 0)
    return b;
  else
    return a % b;
}
int main() {
  int n, m, s;
  scanf("%d%d%d", &n, &m, &s);
  printf("%I64d", (long long)sm(n, s) * sm(m, s) * ((n - 1) / s + 1) *
                      ((m - 1) / s + 1));
}
