#include <bits/stdc++.h>
#pragma comment(linker, "/STACK:16777216")
using namespace std;
int n, m, jm;
long long ans;
int main() {
  cin >> n >> m >> jm;
  ans = ceil(1.0 * n / jm) * ceil(1.0 * m / jm) * ((n - 1) % jm + 1) *
        ((m - 1) % jm + 1);
  cout << ans;
  return 0;
}
