#include <bits/stdc++.h>
using namespace std;
int n, m, s;
int rw[10000001];
int col[10000001];
int main() {
  cin >> n >> m >> s;
  int64_t rwcnt = 0, clcnt = 0, mcnt = 0;
  for (int i = 0; i <= 10000000; i++) {
    rw[i] = 0;
    col[i] = 0;
  }
  for (int i = 1; i <= n; i++)
    if (rw[i] == 0) {
      int64_t cnt = 0;
      for (int j = i; j <= n; j += s) {
        rw[j] = i;
        cnt++;
      }
      if (cnt == mcnt)
        mcnt = cnt, rwcnt += cnt;
      else if (mcnt < cnt)
        mcnt = cnt, rwcnt = cnt;
    }
  mcnt = 0;
  for (int i = 1; i <= m; i++)
    if (col[i] == 0) {
      int64_t cnt = 0;
      for (int j = i; j <= m; j += s) {
        col[j] = i;
        cnt++;
      }
      clcnt = max(clcnt, cnt);
      if (cnt == mcnt)
        mcnt = cnt, clcnt += cnt;
      else if (mcnt < cnt)
        mcnt = cnt, clcnt = cnt;
    }
  if (rwcnt == 1) rwcnt = n;
  if (clcnt == 1) {
    clcnt = m;
  }
  int64_t ans = (int64_t)rwcnt * (int64_t)clcnt;
  cout << ans;
  return 0;
}
