#include <bits/stdc++.h>
#pragma GCC optimize("O3")
#pragma GCC target("sse4")
using namespace std;
long long int MOD = 1000000007;
long long int powmod(long long int a, long long int b) {
  long long int res = 1;
  a %= 1000000009;
  assert(b >= 0);
  for (; b; b >>= 1) {
    if (b & 1) res = res * a % 1000000009;
    a = a * a % 1000000009;
  }
  return res;
}
long long int gcd(long long int a, long long int b) {
  return b ? gcd(b, a % b) : a;
}
long long int add(long long int a, long long int b) {
  return ((a % MOD) + (b % MOD)) % MOD;
}
long long int mul(long long int a, long long int b) {
  return ((a % MOD) * (b % MOD)) % MOD;
}
long long int sub(long long int a, long long int b) {
  return ((a % MOD) - (b % MOD) + MOD) % MOD;
}
long long int binpow(long long int x, long long int y) {
  long long int z = 1;
  while (y) {
    if (y & 1) z = mul(z, x);
    x = mul(x, x);
    y >>= 1;
  }
  return z;
}
long long int count(long long int n, long long int jump) {
  vector<long long int> visited(n + 1, 0);
  long long int cc = 0;
  for (int i = 1; i <= n; i++) {
    long long int bb = 0;
    if (!visited[i]) {
      for (int u = i; u <= n; u += jump) {
        if (u <= n) {
          bb++;
          visited[u] = 1;
        }
      }
      cc = max(cc, bb);
    }
  }
  long long int such = 0;
  for (long long int i = 0; i < n + 1; i++) {
    visited[i] = 0;
  }
  for (int i = 1; i <= n; i++) {
    long long int bb = 0;
    if (!visited[i]) {
      for (int u = i; u <= n; u += jump) {
        if (u <= n) {
          bb++;
          visited[u] = 1;
        }
      }
      if (bb == cc) {
        such++;
      }
    }
  }
  return (cc)*such;
}
int main() {
  ios::sync_with_stdio(false);
  cin.tie(0);
  long long int n, m, second;
  cin >> n >> m >> second;
  long long int ap = count(n, second);
  long long int bp = count(m, second);
  cout << ap * bp << endl;
}
