ar = []
br = []
cr = []
mn = 10
for i in range(5):
    l = input()
    if int(l) % 10 == 0:
        ar.append(int(l))
    else:
        br.append(int(l))
        if mn > int(l) % 10:
            mn = int(l) % 10
for r in br:
    if str(r)[-1] == str(mn) and len(cr) == 0:
        cr.append(r)
    else:
        r += 10 - (r % 10)
        ar.append(r)
print(sum(ar) + cr[0])