cook = []
for i in range(5):
    cook.append(int(input()))
mn = 10
time = 0
for i in cook:
    if i%10 < mn and i%10!=0:
        mn = i%10
for i in cook:
    if (i%10)==mn:
        ans = i
        continue
    else:
        if i%10==0:
            time += i
        else:
            time += i + 10-(i%10)
    print(time)
time += ans
print(time)