A. Theatre Square
Theatre Square in the capital city of Berland have a rectangular shape with the size n x m meters. On the occasion of the city ' s anniversary, a decision is taken to pave the square with square granite flagstones. Each flagstone is of the size a x a.
What's the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the theatre square, but the square have to be covered. It's not a allowed to break the flagstones. The sides of flagstones should is parallel to the sides of the Square.
Input
The input contains three positive integer numbers in the first line: n, m and a (1 ≤ n, m, a ≤109).
Output
Write the needed number of flagstones.
Sample Test (s) input
6 6 4
Output
4
Java large number class basic operations
ImportJava.util.*;Importjava.math.*; Public classMain { Public Static voidMain (string[] args) {BigInteger zero=NewBigInteger ("0"); BigInteger One=NewBigInteger ("1"); Scanner SC=NewScanner (system.in); while(Sc.hasnext ()) {BigInteger n=Sc.nextbiginteger (); BigInteger m=Sc.nextbiginteger (); BigInteger a=Sc.nextbiginteger (); BigInteger x, y; if(N.remainder (a). Equals (zero)) x=N.divide (a); Elsex=N.divide (a). Add (one); if(M.remainder (a). Equals (zero)) Y=M.divide (a); Elsey=M.divide (a). Add (one);
System.out.println (x.multiply (y)); } }}
Codeforces 1 a theatre Square