times-square-1

Times Square in the capital city of NY  has a rectangular shape with the size n × m meters. On the occasion of the city's anniversary, a decision was taken to pave the Square with square granite flagstones. Each flagstone is of the size a × a.

What is the least number of flagstones needed to pave the Square? It's allowed to cover the surface larger than the Times Square, but the Square has to be covered. It's not allowed to break the flagstones. The sides of flagstones should be 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 INPUT
6 6 4

SAMPLE OUTPUT
4

Source: hackerearth | Difficulty: UNKNOWN_DIFFICULTY


Solutions:
import math
n,m,a = list(map(eval, input().split()))
lcount = 0
rcount = 0
while(n>0):
	n-=a
	lcount+=1
while(m>0):
	m-=a
	rcount+=1
print(lcount*rcount)



l = list(map(int, input().split(' ')))
a = l[2]
n = l[0]
m = l[1]
num = 0
if n % a != 0:
	n = (n // a) + 1
else:
	n = n // a

if m % a != 0:
	m = (m // a) + 1
else:
	m = m // a

num = n * m
print(num)


def sq(m,n,a):
	m=int(m)
	n=int(n)
	a=int(a)
	r=m/a
	if m%a!=0:
		r+=1
	c=n/a
	if n%a!=0:
		c+=1
	print(r*c)
	return
m,n,a=input().split()
sq(m,n,a)
	


n,m,a = input().split(" ")
n,m,a = int(n), int(m), int(a)

if( n % a == 0):
	_blocks_required_to_cover_n_direction = n/a
else:
	_blocks_required_to_cover_n_direction  = n/a + 1
	
if( m % a == 0):
	_blocks_required_to_cover_m_direction = m/a
else:
	_blocks_required_to_cover_m_direction  = m/a + 1
	

print(_blocks_required_to_cover_n_direction * _blocks_required_to_cover_m_direction)



n,m,a=list(map(int,input().split()))
num=n/a
if n%a!=0:
	num+=1
s=m/a
if m%a!=0:
	s+=1
print(s*num)