def rest(num):
    return num % 10

A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())
Foods = [A,B,C,D,E]
res = 0

poplist=[]
for idx in range(5):
    if Foods[idx]%10==0:
        res += Foods[idx]
        poplist.append(idx)
while len(poplist)>0:
    idx = max(poplist)
    Foods.pop(idx)
    poplist.pop(idx)

while len(Foods) > 0:
    idx = Foods.index(max(Foods, key=rest))
    if len(Foods)>1:
        res += (Foods[idx]//10)*10+10
    else:
        res += Foods[idx]
    Foods.pop(idx)



print(res)
