def f1(a):
    if a%10==0:
        return a
    else:
        return (a//10+1)*10

arr=[]
for _ in range(5):
    arr.append(int(input()))

brr = map(f1, arr)
crr = filter(lambda x: x!=0, map(lambda x: x%10,arr))
if len(crr)>0:
    print(sum(brr)-10+min(crr))
else:
    print(sum(brr))


