#include <bits/stdc++.h>
using namespace std;
const long long mod = 1000000009;
int main() {
  long long n, m, s;
  cin >> n >> m >> s;
  cout << (long long)ceil(n / (double)s) * (long long)ceil(m / (double)s) *
              (long long)((n - 1LL) % s + 1LL) *
              (long long)((m - 1LL) % s + 1LL);
  return 0;
}
