a = []
for i in range(5):
    a.append(int(input()))
b = []
for i in a:
    if i%10:
        b.append(i)
c = min(b,key = lambda x:x%10)
ans = 0
for i in a:
    if i%10:
        ans += i+(10-i%10)
    else:
        ans += i
print(ans-(10-c%10))