import math
a = int(input())
b = int(input())
c = int(input())
d = int(input())
e = int(input())
a = [a,b,c,d,e]
totaltime = 0
longesttime = 100
for i in range(5):
    tmp = a[i] % 10
    if tmp == 0:
        tmp = 10
    if tmp < longesttime:
        longesttime = a[i] % 10
for i in range(5):
    totaltime += math.ceil(a[i] / 10) * 10
print(totaltime - (10 - longesttime))

