#include <bits/stdc++.h>
using namespace std;
int n, m, s, x, y;
int main() {
  scanf("%d%d%d", &n, &m, &s);
  x = (n % s == 0 ? n : (n / s + 1) * (n % s));
  y = (m % s == 0 ? m : (m / s + 1) * (m % s));
  printf("%I64d", 1ll * x * y);
}
