list = []
timelist=[]
min_time = 9
for i in range(5):
    list.append(int(input()))
for i in list:
    if i%10 == 0:
        timelist.append(i)
    else:
        timelist.append((10-(i%10))+i)
        if i%10 < min_time:
            min_time = i%10
print(sum(timelist)-10+min_time)