A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

minutes = 0
items = [A, B, C, D, E]
rems = [item % 10 for item in items if item % 10 != 0]
cnt = len(rems)
minutes += min(rems)

for item in items:
    minutes += (item//10)*10
 
if cnt > 0:
    minutes += (cnt-1)*10

print(minutes)