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