N = 5
Dishes = [int(input()) for _ in range(N)]
Dishes_10 = [0]*N

for i in range(N):
    d = int(str(Dishes[i])[-1])
    if d!=0:
        Dishes_10[i] = Dishes[i]+10-d
    else:
        Dishes_10[i] = Dishes[i]

Max=0
for i in range(N):
    
    if (Dishes_10[i]-Dishes[i])>Max:
        posi = i
        Max = Dishes_10[i]-Dishes[i]
        
Dishes_10[posi] = Dishes[posi]

print(sum(Dishes_10))