#include <bits/stdc++.h>
using namespace std;
long long n, m, s;
int main() {
  cin >> n >> m >> s;
  if (s >= n && s >= m) {
    cout << n * m << "\n";
  } else {
    if (n < m) swap(n, m);
    long long w = (m - 1) / s, h = (n - 1) / s;
    long long x = (m - (w * s + 1));
    long long y = (n - (h * s + 1));
    long long cells = (h + 1) * (w + 1) * (x + 1) * (y + 1);
    cout << cells << "\n";
  }
}
