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