import sys
input = sys.stdin.readline
a = [0,0,0,0,0]
b = [[0,i] for i in range(5)]
for i in range(5):
    a[i] = int(input())
    b[i][0] = a[i] % 10
b.sort()
j = 0
while b[j][0] == 0:
    j += 1
time = 0
for i in range(5):
    if i != b[j][1]:
        if a[i] % 10 == 0:
            time += a[i]
        else:
            time += (a[i] + (10 - a[i] % 10))
time += a[b[j][1]]
print(time)