a = [int(input()) for i in range(5)]
r = 10
fix = 10000
for i in range(5):
    if a[i] % 10 == 0:
        fix = i
    elif a[i] % 10 < r:
        last = i
        r = int(a[i] % 10)

if fix == 10000:
    b = []
    for i in range(5):
        if i != last:
            b.append(a[i])
    
    b = [int((b[i] + 9) / 10) * 10 for i in range(4)] 

    time = 0
    for i in range(4):
        time = time + b[i]
    
    time = time + a[last]


else:
    b = []
    for i in range(5):
        if i != fix and i != last:
            b.append(a[i])

    b = [int((b[i] + 9) / 10) * 10 for i in range(3)]

    time = 0
    for i in range(3):
        time = time + b[i]

    time = time + a[fix] + a[last]

print(time)