a = gets.to_i
b = gets.to_i
c = gets.to_i
d = gets.to_i
e = gets.to_i
aa = a+10-(a%10)
bb = b+10-(b%10)
cc = c+10-(c%10)
dd = d+10-(d%10)
ee = e+10-(e%10)
am = a%10
bm = b%10
cm = c%10
dm = d%10
em = e%10
array = [am,bm,cm,dm,em]
array.delete(0)
puts aa+bb+cc+dd+ee-10+array.min-(10*(5-array.count))