import math

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

times = sorted([A,B,C,D,E],key=lambda x: x % 10)

res = 0

tmp = 0
for t in times:
    res += math.ceil(t / 10) * 10

for t in times:
    if t % 10 != 0:
        res += t % 10
        break


print(res - 10)
