#include <bits/stdc++.h>
using namespace std;
int main() {
  ios_base::sync_with_stdio(0);
  long long int n, m, s;
  cin >> n >> m >> s;
  cout << ((n % s == 0) ? n : (n / s + 1) * (n % s)) *
              ((m % s == 0) ? m : (m / s + 1) * (m % s));
  return 0;
}
