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