#include <bits/stdc++.h>
using namespace std;
long long n, m, s;
long long row, col;
long long sr, sc;
long long tr, tc;
int main() {
  scanf("%I64d %I64d %I64d", &n, &m, &s);
  row = n / s + 1;
  if (n % s == 0) row--;
  col = m / s + 1;
  if (m % s == 0) col--;
  sr = n - ((row - 1) * s + 1);
  sc = m - ((col - 1) * s + 1);
  tr = (sr + 1) * row;
  tc = (sc + 1) * col;
  printf("%I64d\n", min(n * m, tr * tc));
  return 0;
}
