set=[int(input()) for x in range(5)]
set=[x if x>10 or x==0 else 10 for x in set ]
set.sort(key=lambda x:abs((x+9)%10),reverse=True)
#print(set)
last=[set.pop(-1)]
set=[int(round(x,-1)) for x in set]
print(sum(set+last))
