import math
num_list = [input() for i in range(5)]

num_first =[]

for str1 in num_list:
  number=int(str1[-1])
  if number==0:
    number=9
  num_first.append(number)

index=num_first.index(min(num_first))
sum=0
for i in range(5):
  if i==index:
    sum = sum+int(num_list[i])
  else:
    num2=0
    str2=num_list[i]
    if int(str2[-1])<5 and int(str2[-1])!=0 :
      num2=int(str2)+4
    else:
      num2=int(str2)
    sum=sum+round(num2,-1)
print(sum)