time = [input() for _ in range(5)]
ans = []
min_hitoketa = 9
idx = 0

for i, t in enumerate(time):
    if int(t[-1]) < min_hitoketa and int(t[-1]) >= 1:
        min_hitoketa = int(t[-1])
        idx = i
    
    if t[-1] == '0':
        tmp = t
    elif len(t) == 1:
        tmp = '10'
    else:
        tmp = str(int(t[-2]) + 1) + '0'
    
    ans.append(int(tmp))


ans[idx] = int(time[idx])  
#print(ans)
print(sum(ans))

