ans = 0
a = []
for _ in range(5):
    x = int(input())
    if x%10 == 0:
        ans += x
    else:
        ans += (x//10)*10
        a.append(x%10)

if a == []:
    print(ans)
    exit()
elif len(a) == 1:
    ans += a[0]
    print(ans)
    exit()
ans += (len(a)-1)*10
ans += min(a)