#include <bits/stdc++.h>
using namespace std;
const long long M = 1e9 + 7;
const long long INF = 1e9;
inline long long pwr(long long base, long long n, long long m) {
  long long ans = 1;
  while (n > 0) {
    if (n % 2 == 1) ans = (ans * base) % m;
    base = (base * base) % m;
    n /= 2;
  }
  return ans;
}
int main() {
  ios_base::sync_with_stdio(false);
  cin.tie(NULL);
  long long n, m, r, n1 = 0, m1 = 0;
  cin >> n >> m >> r;
  if (r >= n)
    n1 = n;
  else {
    if (n % r == 0) {
      n1 = n;
    } else {
      long long rem = n % r;
      long long temp = (n - rem) / r;
      n1 = (temp + 1) * rem;
    }
  }
  if (r >= m)
    m1 = m;
  else {
    if (m % r == 0) {
      m1 = m;
    } else {
      long long rem = m % r;
      long long temp = (m - rem) / r;
      m1 = (temp + 1) * rem;
    }
  }
  long long ans = n1 * m1;
  cout << ans;
  return 0;
}
