#include <bits/stdc++.h>
using namespace std;
long long n, m, s, temp1, temp2, baris, colom;
unsigned long long hasil;
int main() {
  cin >> n >> m >> s;
  if (s >= n && s >= m)
    cout << n * m << endl;
  else {
    temp1 = (n - 1) / s + 1;
    temp2 = (m - 1) / s + 1;
    hasil = temp1 * temp2;
    baris = (n - 1) % s + 1;
    colom = (m - 1) % s + 1;
    hasil *= baris * colom;
    cout << hasil << endl;
  }
}
