#include <bits/stdc++.h>
using namespace std;
int cnt[1000010];
long long int get(long long int N, long long int S) {
  long long int lm = 0, l = 0;
  for (int i = 0; i < N; i++) cnt[i] = -1;
  for (int i = 0; i < N; i++) {
    if (cnt[i] == -1) {
      long long int t = 0;
      for (int j = i; j < N; j += S) {
        cnt[j] = 1;
        t += 1;
      }
      if (t == lm)
        l += t;
      else if (t > lm) {
        lm = t;
        l = t;
      }
    }
  }
  return l;
}
int main() {
  long long int N, M, S;
  cin >> N >> M >> S;
  long long int l = get(N, S), r = get(M, S);
  cout << l * r << endl;
  return 0;
}
