from sys import stdin

x = []
x.append(int(stdin.readline().rstrip()))
x.append(int(stdin.readline().rstrip()))
x.append(int(stdin.readline().rstrip()))
x.append(int(stdin.readline().rstrip()))
x.append(int(stdin.readline().rstrip()))

time = []
min = 0
for i in range(0,5):
    if x[i] %10 == 0:
        time.append(x[i])
    else:
        time.append(x[i] - (x[i]%10) + 10)
        if ((x[min]-1) % 10) > (x[i] % 10):
                min = i

time[min] = x[min]

sum_time = 0
for i in range(0,5):
    sum_time += time[i]

print(sum_time)