A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
 
print(((A+9)//10)*10 + ((B+9)//10)*10 + ((C+9)//10)*10 + ((D+9)//10)*10 + ((E+9)//10)*10 + min(A%10, B%10, C%10, D%10, E%10) -10)