icase=0
if icase==0:
    from itertools import permutations, combinations,combinations_with_replacement,product
    a=[0]*5
    for i in range(5):
        a[i]=int(input())
    tmin=123*5
    alist=list(permutations(a))
    for ai in alist:
        t=ai[0]
        t=int((t-1)//10+1)*10+ai[1]
        t=int((t-1)//10+1)*10+ai[2]
        t=int((t-1)//10+1)*10+ai[3]
        t=int((t-1)//10+1)*10+ai[4]
        tmin=min(t,tmin)
    print(tmin)       