#include <bits/stdc++.h>
using namespace std;
int main() {
  long long n, m, s, nn, mm;
  cin >> n >> m >> s;
  nn = n % s;
  mm = m % s;
  if (nn == 0) {
    nn = s;
  }
  if (mm == 0) {
    mm = s;
  }
  if (n % s == 0) {
    nn *= n / s;
  } else {
    nn *= ((n / s) + 1);
  }
  if (m % s == 0) {
    mm *= m / s;
  } else {
    mm *= ((m / s) + 1);
  }
  cout << nn * mm << endl;
  return 0;
}
