#include <bits/stdc++.h>
using namespace std;
inline long long cal(int k, int s) {
  if (k % s == 0)
    return 1ll * (k / s) * s;
  else if (k / s != 0)
    return 1ll * ((k / s) + 1) * (k % s);
  else
    return 1ll * k;
}
int n, m, s;
signed main() {
  while (cin >> n >> m >> s) {
    cout << cal(n, s) * cal(m, s) << "\n";
  }
  return EXIT_SUCCESS;
}
