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

nxt_time = [0]*n
for i in range(n):
    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(n):
    sumtime = 0
    for j in range(n):
        if i == j:
            sumtime += ae[i]
        else:
            sumtime += nxt_time[i]
    
    best_time = min(best_time, sumtime)

print(best_time)