def five_dishes(a,n):
    b = []
    ttime = 0
    maxnum,opt,pos = 0,0,0
    for i in range(n):
        if a[i]%10 == 0:
            pass
        else:
            opt = 10 - a[i]%10
        if maxnum < opt:
            maxnum = opt
            pos = i
    tmp = a.pop(pos)
    for i in range(n-1):
        if a[i]%10 == 0:
            ttime += a[i]
        else:
            ttime += a[i] + 10 - a[i]%10
 
    else:
        ttime += tmp
 
    print("%d"  %ttime)
 
if __name__ == '__main__':
    a = [int(raw_input()) for i in range(5)]
    five_dishes(a,len(a))