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