ans_list = []
z_count = 0
for i in range(5):
    b = int(input())
    c = b%10
    ans_list.append((b,c))
    if c == 0:
        z_count += 1
ans_list.sort(key = lambda x:x[1], reverse = True)
count = 0
ans = 0
for i in range(5-z_count):
    if ans_list[i][1] is not 0:
        ans += (ans_list[i][0] -ans_list[i][1] + 10)
    else:
        ans += ans_list[i][0]
ans -=(10-ans_list[5-z_count-1][1])
for i in range(z_count):
    ans += ans_list[5-z_count+ i][0]

print(ans)