rahuls-shopping
Source: hackerearth
Difficulty: UNKNOWN_DIFFICULTY

Rahul has to buy a few wooden planks ,the shop he visited has 50 different types of wooden planks available.Each type of plank is marked from 1-50.The rate(per square feet) of each plank is calculated as the number marked on the
plank multiplied by sum of the digits of the number marked on the plank.He told the shopkeeper that he needed n number of planks of same dimensions and specified the number on each plank.And also told the size of plank he needed(length & breath(in feet)).Now calculate the total amount he has to pay to the shopkeeper. Also their is Discount available on each type of plank, plank numbered from 1-10 having 25% discount,11-20 having 30% discount ,20-50 having 20% discount.(if the cost of each plank after discount is in decimals e.g. 23.30 then it is rounded off to nearest integer it means 23)

Input:
First line tells the no. of planks n  to brought.
second line  specifies the different planks to be brought.
third line represents the size of plank (length and breath).

Output:
total amount to be paid

Constraints:
1 ≤ n ≤ 50

1 ≤ length,breath ≤ 10

SAMPLE INPUT
3
12 5 42
2 3

SAMPLE OUTPUT
1472

Explanation

In first line 3 is entered as no. of planks to be brought. In second line 12 , 5, 42 are the plank's to be brought & the Third line represents the size of planks 2, 3 (length,breath).

output is the amount to be paid.


input()
typeofplanks = list(map(int, input().split()))
l,b = list(map(int, input().split()))

def sum_digits3(n):
	r = 0
	while n:
		r, n = r + n % 10, n / 10
	return r
#area = l * b
total_price = 0
for p in typeofplanks:
	price = (p * sum_digits3(p))
	if 1 <= p <= 10:
		total_price += int(l * b * (price - (price * 0.25)))
	elif 11 <= p < 20:
		total_price += int(l * b * (price - (price * 0.30)))
	else:
		total_price += int(l * b * (price - (price * 0.20)))

print(total_price)


def discount(n):
	if n<=10:
		return 0.75
	elif n<=20:
		return 0.70
	else:
		return 0.80
a=eval(input())
arr=input().strip().split()
b,c=list(map(int,input().strip().split()))
area=b*c
ans=0
for i in range (a):
    rate=(sum(map(int,arr[i])))*(int(arr[i]))
    ans+=rate*area*discount(int(arr[i]))
if ans-int(ans)>0:
    print(int(ans)-1)
else:
    print(int(ans))


def discount(n):
	if n<=10:
		return 1-0.25
	elif n<=20:
		return 1-0.30
	else:
		return 1-0.20
a=eval(input())
arr=input().strip().split()
b,c=list(map(int,input().strip().split()))
area=b*c
ans=0
for i in range (a):
    rate=(sum(map(int,arr[i])))*(int(arr[i]))
    ans+=rate*area*discount(int(arr[i]))
if ans-int(ans)>0:
    print(int(ans)-1)
else:
    print(int(ans))


input()
typeofplanks = list(map(int, input().split()))
l,b = list(map(int, input().split()))

def sum_digits3(n):
	r = 0
	while n:
		r, n = r + n % 10, n / 10
	return r

total_price = 0
for p in typeofplanks:
	#price = (p * sum(int(digit) for digit in str(p)))
	price = (p * sum_digits3(p))
	if 1 <= p <= 10:
		total_price += int(l * b * (price - (price * 0.25)))
	elif 11 <= p < 20:
		total_price += int(l * b * (price - (price * 0.30)))
	else:
		total_price += int(l * b * (price - (price * 0.20)))

print(total_price)


input()
typeofplanks = list(map(int, input().split()))
l,b = list(map(int, input().split()))

def sum_digits3(n):
	r = 0
	while n:
		r, n = r + n % 10, n / 10
	return r
area = l * b
total_price = 0
for p in typeofplanks:
	price = (p * sum_digits3(p))

	if 1 <= p <= 10:
		total_price += int(area * (price - (price * 0.25)))
	elif 11 <= p < 20:
		total_price += int(area * (price - (price * 0.30)))
	else:
		total_price += int(area * (price - (price * 0.20)))

print(total_price)


from functools import reduce
n = eval(input())
planks = list(map(int,input().split(' ')))
area = reduce(lambda x,y: x*y, list(map(int,input().split(' '))))


cost = 0
for i in planks:
	c = i*reduce(lambda x,y: x+y, list(map(int,list(str(i)))))*area
	if i in range(1,11):
		c -= 0.25*c
	elif i in range(11,21):
		c -= 0.3*c
	else:
		c -= 0.2*c
	c = int(c)
	cost += c

print(cost)


def sd(n):
	r=0
	while (n>0):
		r+=n%10
		n/=10
	return r
	
def d(n):
	if n<=10:
		return 0.25
	elif n>=11 and n<=20:
		return 0.3
	else:
		return 0.2
n=eval(input())
p=list(map(int,input().split()))
l,b=list(map(int,input().split()))
a=l*b
ans=0
for item in p:
	ans+=int(a*(1-d(item))*item*sd(item))
print(ans)


import math
eval(input())
planks = list(map(int, input().split()))
wid, bre = list(map(int, input().split()))
allcost = 0
for i, v in enumerate(planks):
	nSum = sum([int(a) for a in str(v)])
	cost = v * nSum * (wid * bre)
   
	if v in range(1, 11):
		discount = cost * 0.25
		cost -= discount
		#cost =  (round((cost - (((cost * 25))/100))))
	elif v in range(11, 21):
		discount = (cost * 0.30)
		cost -= discount        
		#cost =  (round((cost - (((cost * 30))/100))))
	else:
		discount = (cost * 0.20)
		cost -= discount        
		#cost =  (round((cost - (((cost * 20))/100))))
	allcost += int(cost ) 
	
print(int(allcost))    
		
		
	


input()
typeofplanks = list(map(int, input().split()))
l,b = list(map(int, input().split()))

def sum_digits3(n):
	r = 0
	while n:
		r, n = r + n % 10, n / 10
	return r

total_price = 0
for p in typeofplanks:
	price = (p * sum(int(digit) for digit in str(p)))
	#price = (p * sum_digits3(p))
	if 1 <= p <= 10:
		total_price += int(l * b * (price - (price * 0.25)))
	elif 11 <= p < 20:
		total_price += int(l * b * (price - (price * 0.30)))
	else:
		total_price += int(l * b * (price - (price * 0.20)))

print(total_price)


input()
typeofplanks = list(map(int, input().split()))
l,b = list(map(int, input().split()))
total_price = 0
for p in typeofplanks:
	price = (p * sum(int(digit) for digit in str(p)))
	#price = (p * sum_digits3(p))
	if 1 <= p <= 10:
		total_price += int(l * b * (price - (price * 0.25)))
	elif 11 <= p < 20:
		total_price += int(l * b * (price - (price * 0.30)))
	else:
		total_price += int(l * b * (price - (price * 0.20)))

print(total_price)