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