import sys
def input(): return sys.stdin.readline().strip()

def resolve():
    l=[input() for i in range(5)]
    sum=0
    for j in range(5):
        sum+=(int(l[j])//10)*10
    num=9
    for n in range(5):
        if int(l[n][-1])!=0 and int(l[n][-1]) < num:
            num=int(l[n][-1])
    if num!=0:
        sum-=10-num
    for s in range(5):
        if int(l[s])%10!=0:
            sum+=10
    print(sum)
resolve()