#include <bits/stdc++.h>
#pragma GCC optimize("Ofast")
#pragma GCC target("avx,avx2,fma")
using namespace std;
int main() {
  {
    long long n, m, k, p, s, k1, p1;
    cin >> n >> m >> s;
    if (s == 1) {
      cout << n * m;
      return 0;
    }
    k = (n - 1) % s + 1;
    k1 = n / s;
    if (n % s != 0) k1++;
    k = k1 * k;
    p = (m - 1) % s + 1;
    p1 = m / s;
    if (m % s != 0) p1++;
    p = p1 * p;
    cout << p * k;
    cout << '\n';
  }
  return 0;
}
