A=int(input())
B=int(input())
C=int(input())
D=int(input())
E=int(input())

def k (x):
            if x% 10 != 0:
                        return x-x%10+10
            else:
                        return x          
def m(y):
            if y%10 !=0:
                        return  y%10
            else:
                        return 9
a,b,c,d,e=map(k,[A,B,C,D,E])
a_list = [a,b,c,d,e]
a_1,b_1,c_1,d_1,e_1=map(m,[A,B,C,D,E])
s=sum(a_list)-10+min(a_1,b_1,c_1,d_1,e_1)
print(s)



