a = []
for i in range(5):
    a.append(int(input()))

b = []
for i in range(5):
    b.append(a[i]%10)
  
def kiriage(n):
    if n%10==0:
        return n
    else:
        amari = n%10
        n = n - amari
        return n+10

#non-zero かつ minimum
mini_amari = 9
idx = 9
for i in range(len(b)):
    if b[i]<mini_amari and b[i]!=0:
        mini_amari = b[i]
        idx = i

res = 0
for i in range(len(a)):
    if i != idx:
        res += kiriage(a[i])
res += a[idx]
print(res)