#include <bits/stdc++.h>
using namespace std;
int main() {
  ios::sync_with_stdio(0);
  cin.tie(0);
  long long n, m, s;
  cin >> n >> m >> s;
  long long div1 = n / s;
  long long mod1 = n - s * div1;
  long long p0 = div1 * (s - mod1);
  long long p1 = n - p0;
  long long div2 = m / s;
  long long mod2 = m - s * div2;
  long long q0 = div2 * (s - mod2);
  long long q1 = m - q0;
  if (q1 == 0) q1 = m;
  if (p1 == 0) p1 = n;
  cout << q1 * p1 << endl;
  return 0;
}
