li=[input() for i in range(5)]
mi=9
for i in range(5):
    if int(li[i][-1])!=0:
        mi = min(mi, int(li[i][-1]))
ans = 0

for i in range(5):
    if int(li[i])%10 !=0:
        ans += int(li[i])+(10-int(li[i])%10)
    else:
        ans += int(li[i])
print(ans-10+mi)