A = int(input())
B = int(input())
C = int(input())
D = int(input())
E = int(input())

menu = [A,B,C,D,E]
menu.sort()
count  = 0
for x in menu:
    if x % 10 == 0:
        count += x
    else:
        count += 10 + (x//10)*10

cache = 10**5
for x in menu:
    if x%10 == 0:
        continue
    if cache > x%10:
        cache = x%10
count -= (10 - cache)
print(count)