times-square

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:
def ceiling(n,a):
	div=n/a
	res=n%a
	if res!=0:
		div+=1
	return int(div)
		
in1=input()
lst=in1.split()
n=int(lst[0])
m=int(lst[1])
a=int(lst[2])
num1=ceiling(n,a)
num2=ceiling(m,a)
print(num1*num2) ### ofc! multiply




'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
n,m,a=list(map(int,input().split()))
if m%a==0 and n%a==0:
	print(max(n,m))
elif m%a==0:
	print((m/a)*(n/a+1))
elif n%a==0:
	print((n/a)*(m/a+1))
else:
	print((m/a+1)*(n/a+1))


def ceiling(n,a):
	div=n/a
	res=n%a
	if res!=0:
		div+=1
	return int(div)
		
in1=input()
lst=in1.split()
n=int(lst[0])
m=int(lst[1])
a=int(lst[2])
num1=ceiling(n,a)
num2=ceiling(m,a)
print(num1*num2)




def gcd(a,b):
	if b==0:
		return a
	else:
		return gcd(b,a%b)
n,m,a=list(map(int,input().split()))
if m%a!=0:
	m=(a-m%a+m)
if n%a!=0:
	n=(a-n%a+n)
print(m/a*n/a)



'''
# Read input from stdin and provide input before running code

name = raw_input('What is your name?\n')
print 'Hi, %s.' % name
'''
#print 'Hello World!'
n,m,a=list(map(int,input().split()))
if m%a==0 and n%a==0:
	print(max(n,m))
elif m%a==0:
	print((m/a)*(n/a+1))
elif n%a==0:
	print((n/a)*(m/a+1))
else:
	print((m/a+1)*(n/a+1))