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.
t=input()
a=map(int,raw_input().split())
b=map(int,raw_input().split())
fi=0

for i in range(0,t):
	c=str(a[i])
	temp=0
	for j in range(0,len(c)):
		temp=temp+int(c[j])
	temp=temp*a[i]*b[0]*b[1]*1.0
	temp2=temp*1.0
	if(a[i]>=1 and a[i]<=10):
		temp=temp/4
	elif(a[i]>=21 and a[i]<=50):
		temp=temp*20
		temp=temp/100
	elif(a[i]>=11 and a[i]<=20):
		temp=temp*30
		temp=temp/100
	fi=fi+int(temp2-temp)
print fi