l = [input() for _ in [0] * 5]
keta =[]
for i in l:
    keta.append(i)
xxx = []
for j in keta:
    if int(j[-1]) != 0:
        xxx.append(int(j) + (10 - int(j[-1])))
    else:
        xxx.append(int(j))

yyy = []
for k in keta:
    yyy.append(int(k[-1]))
zzz = []
for l in yyy:
    if int(l) > 0:
        zzz.append(l)
p = min(zzz)
print(sum(xxx) - p)
