ae = [int(input()) for _ in range(5)]

# sum_ae = 0
# g = 9
# cnt = 0  
# for i in ae:
#     if i % 10 != 0:
#         g = min(g, i % 10)
#         sum_ae += (i//10 + 1) * 10
#         cnt += 1
#     else:
#         sum_ae += i
# if cnt != 0:
#     print(sum_ae - (10-g))
# else:
#     print(sum_ae)

nxt_time = [0]*5
for i in range(5):
    if ae[i] % 10 == 0:
        nxt_time[i] = ae[i]
    else:
        nxt_time[i] = ae[i] - ae[i] % 10 + 10
    # nxt_time[i] = (ae[i]+9) // 10 * 10
best_time = 99999999
for i in range(5):
    sumtime = 0
    for j in range(5):
        if i == j:
            sumtime += ae[i]
        else:
            sumtime += nxt_time[i]
    
    best_time = min(best_time, sumtime)

print(best_time)