#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, s;
  cin >> n >> m >> s;
  long long v = (n - 1) / s + 1;
  long long v1 = (n - 1) % s + 1;
  long long h = (m - 1) / s + 1;
  long long h1 = (m - 1) % s + 1;
  if (v == 0 && m == 0) {
    printf("%I64d\n", n * m);
  } else if (v == 0 && h != 0) {
    printf("%I64d\n", h * h1);
  } else if (v != 0 && h == 0) {
    printf("%I64d\n", v * v1);
  } else {
    printf("%I64d\n", v * v1 * h * h1);
  }
  return 0;
}
