A=int(input())
a=A%10
B=int(input())
b=B%10
C=int(input())
c=C%10
D=int(input())
d=D%10
E=int(input())
e=E%10
if a=b=c=d=e=0:
  print(A-a+B-b+C-c+D-d+E-e+4*10-10*[a,b,c,d,e].count(0))
else:
  print(A-a+B-b+C-c+D-d+E-e+4*10+min(set([a,b,c,d,e])-set([0]))-10*[a,b,c,d,e].count(0))