#include <bits/stdc++.h>
using namespace std;
long long value(int a, int b) {
  long long ans = 1;
  int k1, k2;
  if (a % b == 0 || a <= b)
    ans = (long long)a;
  else {
    k1 = (a - 1) / b;
    k2 = a - k1 * b;
    ans = (long long)(k1 + 1) * k2;
  }
  return ans;
}
int main() {
  int n, m, s;
  long long ans = 1;
  scanf("%d%d%d", &n, &m, &s);
  ans = value(n, s) * value(m, s);
  cout << ans << endl;
  return 0;
}
