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

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

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

Dishes_10[posi] = Dishes[posi]

print(sum(Dishes_10))